sort each row of a matrix in a descending order

1 回表示 (過去 30 日間)
alpedhuez
alpedhuez 2022 年 7 月 15 日
編集済み: alpedhuez 2022 年 7 月 15 日
Suppose I have a matrix
[1 2 3
4 5 6
7 8 9]
I want to sort each row in a descending order so that it will be
[3 2 1
6 5 4
9 8 7]

採用された回答

Stephen23
Stephen23 2022 年 7 月 15 日
編集済み: Stephen23 2022 年 7 月 15 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by