how to find out position of minimum element in a matrix

조회 수: 6 (최근 30일)
Joy Mondal
Joy Mondal 2018년 5월 7일
답변: Rik 2018년 5월 7일
a=[8 2 5;2 -2 4;9 5 4] here position of minimum value is 2*2

채택된 답변

Rik
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개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by