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