필터 지우기
필터 지우기

sort from largest to smallest

조회 수: 129 (최근 30일)
Quynh tran
Quynh tran 2017년 5월 19일
댓글: Steven Lord 2019년 8월 12일
Dear all, I have this matrix:
A=[1 3
3 6
4 7
5 8
6 2
8 3
9 6]
Could you help me how to arrange the first colum from max to min

채택된 답변

James Tursa
James Tursa 2017년 5월 19일
편집: James Tursa 2017년 5월 19일
sort(A(:,1),'descend')
If you want to sort the matrix A by rows based on the first column, then e.g.
flipud(sortrows(A))
Or variations of the above based on what you want for output.
  댓글 수: 3
antlhem
antlhem 2019년 8월 7일
Hi, wat's the oposite of flipud? I want to sort the whole rows in ascedent way
Steven Lord
Steven Lord 2019년 8월 12일
flipud is the opposite of flipud, but that's not the solution you're looking for. Either calling sort with 'ascend' instead of 'descend' or omitting that option entirely (since 'ascend' is the default direction) are the solutions you're looking for.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by