0
在數據集中,如何將數據從大到小排序? 使用sort
數據成爲從小到大:將數據從大到小排序
a=[1 3 5 2 6];
b=sort(a);
b=[1 2 3 5 6];
,但我想b
:
b=[6 5 3 2 1]
在數據集中,如何將數據從大到小排序? 使用sort
數據成爲從小到大:將數據從大到小排序
a=[1 3 5 2 6];
b=sort(a);
b=[1 2 3 5 6];
,但我想b
:
b=[6 5 3 2 1]
檢查http://www.mathworks.com/help/matlab/ref/sort.html。排序功能可以採用模式參數。
b = sort(a) % 'ascend' by default
b = sort(a, 'descend') % sort data from large to small
[點擊進入](http://stackoverflow.com/questions/5802512/sorting-arrays-in-matlab)[一](HTTP://計算器。 com/questions/18820130/sort-matlab-array-in-descending-order)[word](http://www.mathworks.se/help/matlab/ref/sort.html)[...](http: //matlabgeeks.com/tips-tutorials/sorting-data-in-matlab/) –
'doc sort'會讓你在那裏。 – SamuelNLP