Finding Max Value From Matlab Variable

조회 수: 12 (최근 30일)
rizwan
rizwan 2015년 3월 22일
댓글: Image Analyst 2015년 3월 22일
Hi Experts,
I have a variable
out
i want to extract the max value and its corresponding cell value i.e 17531 and 3 .....i used max function i.e
a = max(out);
but it is displaying 4 17531.............I dont know why it is showing 4 instead of 3???Please help

채택된 답변

Andreas Goser
Andreas Goser 2015년 3월 22일
편집: Andreas Goser 2015년 3월 22일
That is a nice one! But in the doc it says
"If A is a matrix, then max(A) treats the columns of A as vectors and returns a row vector of largest elements."
So you maybe want to do something else? Like
[a,ix]=max(out(:,2))
  댓글 수: 3
Andreas Goser
Andreas Goser 2015년 3월 22일
If you can provide data and code together, that is easier for me to help. Otherwise I need to make guesses.
Image Analyst
Image Analyst 2015년 3월 22일
This latest question is a duplicate of a different one. One that I responded to in http://www.mathworks.com/matlabcentral/answers/184466-for-loop-issue-in-code#comment_273784

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by