how to find the indices of some values in a matrix
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Star Strider
2014-5-28
It should find all of them.
Try:
[r0,c0] = find(X==x0)
[r1,c1] = find(X==x1)
5 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!