how to find the indices of some values in a matrix
2 views (last 30 days)
Show older comments
Hi everybody,
I have a 501*2 matrix,and I want to find the indices of two elements. I use find(X==x0) and find(X==x1) to find the elements, I know that these elements exist, but it give me nothing! it gives me one but not the other one! what is the solution? I used strfind(X,x0) also but it has the same problem!
0 Comments
Answers (1)
Star Strider
on 28 May 2014
It should find all of them.
Try:
[r0,c0] = find(X==x0)
[r1,c1] = find(X==x1)
5 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!