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.

采纳的回答

KALYAN ACHARJYA
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
KSSV 2021-2-23
A = rand(100) ;
[val,idx] = min(A(:)) ;
[i,j] = ind2sub(size(A),idx) ;
val
val = 2.7946e-05
A(i,j)
ans = 2.7946e-05

类别

Help CenterFile Exchange 中查找有关 Operators and Elementary Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by