필터 지우기
필터 지우기

how to get 3 indices of the min value?

조회 수: 1 (최근 30일)
Sagi
Sagi 2014년 9월 17일
댓글: Sagi 2014년 9월 18일
hey guys,I built this function:
err=zeros(15,15,15);
for p=-7:7;
for r=-7:7;
for q=-7:7;
zR=gwl*p*1.12+xR;
zG=gwl*q+xG;
zB=gwl*r*0.88+xB;
h=0.33*(abs(zR-zB)+abs(zB-zG)+abs(zR-zG));
err(8+p,8+r,8+q)=h;
end
end
end
and now i need know the 3 indices of the min value of err, any ideas how to achieve it?
thanks in advance

채택된 답변

Roger Stafford
Roger Stafford 2014년 9월 17일
[~,ix] = min(err(:));
[i1,i2,i3] = ind2sub(size(err),ix);
The minimum value is err(i1,i2,i3).
  댓글 수: 1
Sagi
Sagi 2014년 9월 18일
thanks that does the work!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by