find indices of elements in terms of another vector
11 views (last 30 days)
Show older comments
Hi, I have two vectors that can be simplified as follows;
v1 v2
134 134
135 137
137
138
140
Now I would like to find the index of v2 in terms of v1, which results in as below:
v3
1
3
.
.
.
I tried to use find function, but I couldn't get it right. Can anyone help me to resolve it other than for loop? Thank you.
Minsoo
0 Comments
Answers (2)
Paulo Silva
on 26 Jun 2011
m=[134
135
137
138
140]
n=[137
134]
[c ia ib]=intersect(m,n);
ia
You just want ia
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!