Sort 1 colum and other colums sort correspondingly

5 visualizaciones (últimos 30 días)
Sam
Sam el 12 de Jun. de 2015
Editada: Azzi Abdelmalek el 12 de Jun. de 2015
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?

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 12 de Jun. de 2015
Editada: Azzi Abdelmalek el 12 de Jun. de 2015
Use sortrows
v=[{'a' 'b' 'zygz' 'c'};num2cell(randi(4,10,4))] % Example
M=v(2:end,:)
out=sortrows(M,3)

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by