Sort 1 colum and other colums sort correspondingly

2 次查看(过去 30 天)
Hello,
In attach is a picture of the data set I want to sort. I want sort by 'ZYGE' in ascending way. But I don't want the column of 'ZYGE' to change alone. The data must stick together. So that all the numbers of the row stick together, but the data gets sorted by 'ZYGE'. How do I do this?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2015-6-12
编辑:Azzi Abdelmalek 2015-6-12
Use sortrows
v=[{'a' 'b' 'zygz' 'c'};num2cell(randi(4,10,4))] % Example
M=v(2:end,:)
out=sortrows(M,3)

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