Index of a matrix?
1 次查看(过去 30 天)
显示 更早的评论
I have two column matricies x and y (neither of them have repeating numbers). I want to search for a number in matrix x, get the index and get the number of that index in matrix y. This seems simple enough to do, but I am still not that familiar with matlab. Can someone help me out please?
1 个评论
Oleg Komarov
2011-7-31
This post requires merging with: http://www.mathworks.com/matlabcentral/answers/12768-i-cannot-find-the-index-of-a-specific-element-in-an-array.
采纳的回答
the cyclist
2011-7-31
index = (x==A); % A is the number you want to find in x.
y(index)
You would probably benefit from spending some time here: http://www.mathworks.com/help/techdoc/learn_matlab/bqr_2pl.html
2 个评论
Andrei Bobrov
2011-7-31
see: <http://www.mathworks.com/matlabcentral/answers/12768-i-cannot-find-the-index-of-a-specific-element-in-an-array>
eg:
ind = find(abs(x - 1.5) < 100*eps)
更多回答(0 个)
另请参阅
类别
在 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!