How to arrange ascending order only one column of a matrix?

1 visualización (últimos 30 días)
Arnab Pal
Arnab Pal el 15 de Feb. de 2018
Respondida: Andrei Bobrov el 15 de Feb. de 2018
Let's say, I have a=[25 10 85 35 71; 1 2 3 4 5] and output shout come b=[10 25 35 71 85; 2 1 4 5 3]

Respuesta aceptada

Birdman
Birdman el 15 de Feb. de 2018
b=sortrows(a.').'

Más respuestas (1)

Andrei Bobrov
Andrei Bobrov el 15 de Feb. de 2018
[~,ii] = sort(a(1,:));
out = a(:,ii);

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by