Sort 1 colum and other colums sort correspondingly

조회 수: 1 (최근 30일)
Sam
Sam 2015년 6월 12일
편집: Azzi Abdelmalek 2015년 6월 12일
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