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

3 Ansichten (letzte 30 Tage)
Arnab Pal
Arnab Pal am 15 Feb. 2018
Beantwortet: Andrei Bobrov am 15 Feb. 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]

Akzeptierte Antwort

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

Weitere Antworten (1)

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

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by