Sorting matrix

4 次查看(过去 30 天)
FIR
FIR 2012-2-18
编辑: Cedric 2013-10-15
I have amatrix
A=[1 2 13;
10 1 2;
8 14 3]
I want to sort 2nd column,so the corresponding values must also change
as
A=[10 1 2;
1 2 13;
8 14 3]

采纳的回答

Wayne King
Wayne King 2012-2-18
[~,indices] = sort(A(:,2));
A = A(indices,:);
  1 个评论
FIR
FIR 2012-2-18
Thanks Wayne can u answer the question in plz
http://www.mathworks.in/matlabcentral/answers/29490-error-using-cell2mat

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by