how to sort variable of an array?

3 次查看(过去 30 天)
Ali Mukhtar
Ali Mukhtar 2019-9-12
回答: Matt J 2019-9-13
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 个评论
Stephen23
Stephen23 2019-9-12
编辑:Stephen23 2019-9-13
"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?

请先登录,再进行评论。

回答(1 个)

Matt J
Matt J 2019-9-13
sort(M,'descend')

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by