How to find the indices of elements in an array?

조회 수: 1 (최근 30일)
Ramya Gutta
Ramya Gutta 2021년 2월 23일
편집: KALYAN ACHARJYA 2021년 2월 24일
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
  댓글 수: 3
KSSV
KSSV 2021년 2월 23일
Read about logical indexing.
Ramya Gutta
Ramya Gutta 2021년 2월 23일
Okay. Thank you.

댓글을 달려면 로그인하십시오.

카테고리

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