필터 지우기
필터 지우기

How to sort a matrix so that sorting a column will make changes to corresponding other columns??

조회 수: 1 (최근 30일)
Lets say that my matrix is
[ x3 y3
x1 y1
x2 y2]
I want to sort the second column y in ascending order so that the respective 1'st column is also sorted accordingly. I want the output to be like this:
[ x1 y1
x2 y2
x3 y3]
How do I do that?

채택된 답변

Mischa Kim
Mischa Kim 2014년 7월 3일
Nathan, use the sortrows command.

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