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]

 Respuesta aceptada

Wayne King
Wayne King el 18 de Feb. de 2012

0 votos

[~,indices] = sort(A(:,2));
A = A(indices,:);

1 comentario

FIR
FIR el 18 de Feb. de 2012
Thanks Wayne can u answer the question in plz
http://www.mathworks.in/matlabcentral/answers/29490-error-using-cell2mat

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

FIR
el 18 de Feb. de 2012

Editada:

el 15 de Oct. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by