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

1 view (last 30 days)
How would i sort a 15 x 5 matrix descending based on the 5th column without changing the first column.

Accepted Answer

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

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!