searching for vector values in a matrix
显示 更早的评论
Hi, I have a vector with 3 specific values and I want to find their indices in a matrix.
1 个评论
James Tursa
2015-4-28
What are the dimensions of the matrix? Do the values have to be next to each other in the same row or column?
采纳的回答
更多回答(1 个)
Image Analyst
2015-4-28
If yourVector is an integer valued vector or a floating point vector with values that are multiples or divisors of 2, then try
firstIndex = find(yourVector == firstSpecificValue);
secondIndex = find(yourVector == secondSpecificValue);
thirdIndex = find(yourVector == thirdSpecificValue);
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!