Row Sorting of Matrices
Afficher commentaires plus anciens
Hi!
Im trying to sort the rows of this matrix in decreacing order with all rows with entries containing zeros (in the first nonzero coloum) gathered at the bottom. By using sortrows(A) im able to sort the rows in decreacing order but have no success in gathering the zero rows in the bottom of the matrix.
I hope this clarifies what i mean.
A =
0 2 4
0 1 6
0 0 5
>> sortrows(A)
ans =
0 0 5
0 1 6
0 2 4
But i want the matrix to be sorted in this way. Shown below.
A=
0 1 6
0 2 4
0 0 5
Im Seeking a generall solution, this matrix is just an example
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!