how to sort variable of an array?

2 visualizaciones (últimos 30 días)
Ali Mukhtar
Ali Mukhtar el 12 de Sept. de 2019
Respondida: Matt J el 13 de Sept. de 2019
let suppose we have 3 varaibles A=45, B=54,C=23 and we stores data in matrix M=[A B C] i want to sort on basis of their numerical value like M=[B A C] dont want to change it in numerical form
  1 comentario
Stephen23
Stephen23 el 12 de Sept. de 2019
Editada: Stephen23 el 13 de Sept. de 2019
"how to sort variable..:"
Variables in the workspace do not have an "order", so variables cannot be "sorted".
Elements of an array have an order, so array elements can be sorted.
What exactly are you trying to achieve?

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 13 de Sept. de 2019
sort(M,'descend')

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