how to sort variable of an array?

조회 수: 1 (최근 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