필터 지우기
필터 지우기

how to show index number of minimum value from matrices?

조회 수: 2 (최근 30일)
FARAH HANIM AMIR
FARAH HANIM AMIR 2017년 4월 24일
댓글: FARAH HANIM AMIR 2017년 4월 24일
i am doing a recognition system where i need to locate the minimum value for each row from the 40 by 40 matrices..i now can produce the list of minimum value from each row using this code.. A=min(euc,[], 2); but i still want it to show the minimum number produced is from which column (index number).. how do i write it?
best regards, farah

채택된 답변

KSSV
KSSV 2017년 4월 24일
K = rand(5) ;
[val,idx] = min(K,[],2) ;
r = [1:size(K,1)]' ;
% positions
[r idx]

추가 답변 (1개)

Adam
Adam 2017년 4월 24일
[A, idx] = min(euc,[], 2);
provides the index, as shown in the documentation
doc min

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by