how to sort only first column in matlab

3 次查看(过去 30 天)
X=0.5 1.0;0.1 2;2.5 4 output must be like 0.1 2;0.5 1.0;2.5 4

采纳的回答

Star Strider
Star Strider 2016-8-27
Use the sortrows funciton:
X = [0.5 1.0;0.1 2;2.5 4];
Output = sortrows(X, 1)
Output =
0.1 2
0.5 1
2.5 4

更多回答(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