MATLAB Answers

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

1 view (last 30 days)
Kalpha.mc
Kalpha.mc on 20 Sep 2020
Answered: David Hill on 20 Sep 2020
How would i sort a 15 x 5 matrix descending based on the 5th column without changing the first column.

  0 Comments

Sign in to comment.

Accepted Answer

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

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!