Is there a command ( like "sort" for example ) arranges vector elements ascending ,max, descending (humped shap)?
Mostra commenti meno recenti
Is there a command ( like "sort" for example ) arranges vector elements ascending ,max, descending (humped shap)?
6 Commenti
Bob Thompson
il 28 Ott 2019
Adam
il 28 Ott 2019
'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
il 28 Ott 2019
Mohammed AlThani
il 28 Ott 2019
Bob Thompson
il 28 Ott 2019
How do you differentiate between [24531] and [13542]?
Risposta accettata
Più risposte (1)
Yuan Li
il 28 Ott 2019
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]
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!