How to sort one column of a matrix

조회 수: 33 (최근 30일)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 8월 13일
댓글: Zeynab Mousavikhamene 2019년 8월 13일
I have a matrix that has 500 rows and 5 columns. I want to sort the matrix based on the 3 rd column. I mean rearrange the matrix based on the 3rd column descending.

채택된 답변

Stephan
Stephan 2019년 8월 13일
편집: Stephan 2019년 8월 13일
B = sortrows(A,-3)
  댓글 수: 3
Stephan
Stephan 2019년 8월 13일
편집: Stephan 2019년 8월 13일
note that i used
sortrows
instead of
sort
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 8월 13일
Thanks!

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

추가 답변 (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