Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
Arnab Pal
Arnab Pal le 15 Fév 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]

Réponse acceptée

Birdman
Birdman le 15 Fév 2018
b=sortrows(a.').'

Plus de réponses (1)

Andrei Bobrov
Andrei Bobrov le 15 Fév 2018
[~,ii] = sort(a(1,:));
out = a(:,ii);

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by