how to find out position of minimum element in a matrix
14 次查看(过去 30 天)
显示 更早的评论
a=[8 2 5;2 -2 4;9 5 4] here position of minimum value is 2*2
0 个评论
采纳的回答
Rik
2018-5-7
a=[8 2 5;2 -2 4;9 5 4] ;
[r,c]=find(a==min(a(:)));
This will even work if there are multiple positions where the minimum value exists: in that case r and c will be vectors.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!