Sorting matrix

4 vues (au cours des 30 derniers jours)
FIR
FIR le 18 Fév 2012
Modifié(e) : Cedric le 15 Oct 2013
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]

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by