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

3 次查看(过去 30 天)
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]

采纳的回答

Birdman
Birdman 2018-2-15
b=sortrows(a.').'

更多回答(1 个)

Andrei Bobrov
Andrei Bobrov 2018-2-15
[~,ii] = sort(a(1,:));
out = a(:,ii);

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by