How to find the indices of elements in an array?
1 次查看(过去 30 天)
显示 更早的评论
I have a 103x103 array of values, in which i have to take the smallest values and get the respective (i,j) indices of those values. Can someone help me out with this problem.
0 个评论
采纳的回答
KALYAN ACHARJYA
2021-2-23
编辑:KALYAN ACHARJYA
2021-2-24
[r,c]=find(matrix==min(matrix(:)))
#Added
Get the values
matrix(matrix==min(matrix(:)))
更多回答(1 个)
KSSV
2021-2-23
A = rand(100) ;
[val,idx] = min(A(:)) ;
[i,j] = ind2sub(size(A),idx) ;
val
A(i,j)
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!