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

1 Ansicht (letzte 30 Tage)
Zach Adams
Zach Adams am 7 Okt. 2019
Beantwortet: Walter Roberson am 7 Okt. 2019
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.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 7 Okt. 2019
target_value = max(TheColumn);
find(TheColumn == target_value)

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by