I am using max function. I need to be able to find 2 values.
이전 댓글 표시
My array contains 5 columns and 61 rows. I need to be able to find the max value of each column and the value in the 1st column associated with each maximum. The first column is years incrementing from 1950 to 2010. I seem to be able to get the correct max but can only get the index of the row where it occurs. Any ideas? I am a student and a newbie.
댓글 수: 2
madhan ravi
2020년 6월 8일
Illustration with 5 X 5 matrix with expected result?
Edward Pierce
2020년 6월 8일
채택된 답변
추가 답변 (1개)
John D'Errico
2020년 6월 8일
READ THE HELP FOR MAX.
A = rand(61,5);
>> [MaxA,ind] = max(A)
MaxA =
0.97868 0.99908 0.96865 0.94517 0.9937
ind =
33 34 30 37 8
What information does the second return argument provide? How can you new use that variable to give you what you need?
댓글 수: 3
Edward Pierce
2020년 6월 8일
John D'Errico
2020년 6월 10일
David gave you code to do it, which is in fact coincidentally, exactly what I said to do.
Edward Pierce
2020년 6월 10일
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!