how to sort variable of an array?

2 Ansichten (letzte 30 Tage)
Ali Mukhtar
Ali Mukhtar am 12 Sep. 2019
Beantwortet: Matt J am 13 Sep. 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 Kommentar
Stephen23
Stephen23 am 12 Sep. 2019
Bearbeitet: Stephen23 am 13 Sep. 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?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt J
Matt J am 13 Sep. 2019
sort(M,'descend')

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by