Row Sorting of Matrices
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Shifting and Sorting Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!