How to sort one column of a matrix

34 visualizaciones (últimos 30 días)
Zeynab Mousavikhamene
Zeynab Mousavikhamene el 13 de Ag. de 2019
Comentada: Zeynab Mousavikhamene el 13 de Ag. de 2019
I have a matrix that has 500 rows and 5 columns. I want to sort the matrix based on the 3 rd column. I mean rearrange the matrix based on the 3rd column descending.

Respuesta aceptada

Stephan
Stephan el 13 de Ag. de 2019
Editada: Stephan el 13 de Ag. de 2019
B = sortrows(A,-3)
  3 comentarios
Stephan
Stephan el 13 de Ag. de 2019
Editada: Stephan el 13 de Ag. de 2019
note that i used
sortrows
instead of
sort
Zeynab Mousavikhamene
Zeynab Mousavikhamene el 13 de Ag. de 2019
Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by