Show all indices of I in [C,I] = max(...)

조회 수: 3 (최근 30일)
Zach Adams
Zach Adams 2019년 10월 7일
답변: Walter Roberson 2019년 10월 7일
I am trying to show all of the row values that share a maximum value of a certain column. How do I show all indices for this instead of just the first index?
A sample array would look like:
1 9
2 9
3 4
4 5
I need an output of I = 1 and I = 2 because they share the max value of nine.

채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 7일
target_value = max(TheColumn);
find(TheColumn == target_value)

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by