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!