How to find maximum without duplicates?
Ältere Kommentare anzeigen
I have the matrix, A = [1 2 1 0 0 2; 2 1 4 2 0 0; 1 1 0 2 1 1; 1 1 0 1 4 2] I understand that max(A) gives the maximum for each column,but how do I create a logical array locating the maximum of each column? If there is a tie, I just want to consider the first occurrence of the maximum.
5 Kommentare
Paolo
am 3 Jun. 2018
By 'tie' you refer to the case where the same max value appears twice in the column? As is the case for number 2, in columns 4 and 6 of your example?
Zev Hirt
am 3 Jun. 2018
Paolo
am 3 Jun. 2018
I'm not sure I understand though, how can you find the max if you do not compare all values?
If the output of max(A) is
2 2 4 2 4 2
What is your desired output for matrix A?
Zev Hirt
am 3 Jun. 2018
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!