Sort array based on particular rows
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MechenG
am 12 Feb. 2025
Bearbeitet: Stephen23
am 12 Feb. 2025
Hi,
I have 33 x 2 array, here I need to re arrange the values in descending order based on values in the first colum. I know that I can use 'sort' function for this.
However here the challenge is I need to re arrange first 6 rows and next 5 rows, then next 6 rows and then next 5 rows like this until 33 rows. Could some one please help with this?
1 Kommentar
Akzeptierte Antwort
Weitere Antworten (1)
Voss
am 12 Feb. 2025
out = load('matlab.mat').out
C = mat2cell(out,[6 5 6 5 6 5]);
C = cellfun(@(x)sortrows(x,1,'descend'),C,'UniformOutput',false);
out = vertcat(C{:})
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices 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!