How to find second largest OR third largest Or any largest value among the columns of a matrix?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Furqan Haider
am 7 Okt. 2014
Kommentiert: Kasun Kariyawasam
am 16 Nov. 2018
I have a matrix A=rand(7,25)
I want to find the second largest/third largest/fourth/fifth and sixth largest value among all the columns of matrix "A". No need of seventh largest as there are total 7 values in each column.
Thank you.
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 7 Okt. 2014
Bearbeitet: Azzi Abdelmalek
am 7 Okt. 2014
A=rand(7,25)
[aa,indices]=sort(A,'descend')
4 Kommentare
Image Analyst
am 7 Okt. 2014
They're all in indices. Why do you need different arrays??? If you do, just do
maxIndexes = indices(1,:);
max2Indexes = indices(2,:);
max3Indexes = indices(3,:);
and so on.
Kasun Kariyawasam
am 16 Nov. 2018
Thanks very much. This is a good one - it gives correct indices of the original array for any max
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!