How can i sort all the rows of a matrix but one along a row

1 Ansicht (letzte 30 Tage)
Kalpha.mc
Kalpha.mc am 20 Sep. 2020
Beantwortet: David Hill am 20 Sep. 2020
How would i sort a 15 x 5 matrix descending based on the 5th column without changing the first column.

Akzeptierte Antwort

David Hill
David Hill am 20 Sep. 2020
b=[a(:,1),sortrows(a(:,2:end),4,'descend')];

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by