sort each row of a matrix in a descending order

조회 수: 2 (최근 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 CenterFile Exchange에서 Shifting 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