필터 지우기
필터 지우기

Return the number of the row that contains the largest value in column vectors

조회 수: 1 (최근 30일)
Hi there,
Is there a way in matlab to return the number of a row that contains the largest value?
For example, for the following matrix
0.14 0 0.99 1 0
0.73 0.93 0.02 0 0
0 0 0 0 0.99
0 0 0.01 0 0
0.01 0.05 0.03 0.01 0
0 0.02 0 0 0.02
0.01 0 0.01 0 0
How could you make it return 2 2 1 1 3?
Many thanks John

채택된 답변

the cyclist
the cyclist 2012년 2월 4일
The second output argument of the max() function will do this:
[m index] = max(x)
where x is your matrix. Note that by default, max() works down the columns of a matrix. Read "doc max" for more details.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by