sort each row of a matrix in a descending order

 Accepted Answer

A = [1 2 3; 4 5 6; 7 8 9]
A = 3×3
1 2 3 4 5 6 7 8 9
B = sort(A,2,'descend')
B = 3×3
3 2 1 6 5 4 9 8 7

More Answers (0)

Categories

Products

Release

R2022a

Tags

Asked:

on 15 Jul 2022

Edited:

on 15 Jul 2022

Community Treasure Hunt

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

Start Hunting!