Is there a command ( like "sort" for example ) arranges vector elements ascending ,max, descending (humped shap)?
이전 댓글 표시
Is there a command ( like "sort" for example ) arranges vector elements ascending ,max, descending (humped shap)?
댓글 수: 6
Bob Thompson
2019년 10월 28일
Adam
2019년 10월 28일
'ascending, max, descending' is not uniquely defined for a vector of values. Can you give an example of what kind of logic you expect such a function to use?
Mohammed AlThani
2019년 10월 28일
Mohammed AlThani
2019년 10월 28일
Bob Thompson
2019년 10월 28일
How do you differentiate between [24531] and [13542]?
채택된 답변
추가 답변 (1개)
Yuan Li
2019년 10월 28일
Yes. Use sort.
e.g.
a = [1,3,2,4];
b = sort(a,'ascend');% b = [1,2,3,4]
c = sort(a,'descend');% c = [4,3,2,1]
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!