How to get first 3 maximum number in a matrix
Ältere Kommentare anzeigen
Suppose I have a matrix m:
m = [7;1;4;4;12;2;6;10;2];
I want to find first 3 maximum in matrix m, means like:
n = [7;12;10]; % sorting is not issue
Akzeptierte Antwort
Weitere Antworten (2)
Azzi Abdelmalek
am 4 Nov. 2014
n=sort(m)
n=n(end:end-2)
Matt J
am 5 Nov. 2014
0 Stimmen
Bruno Luong took the trouble to make a fast MEX implementation
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!