Effacer les filtres
Effacer les filtres

Retrun largest numbers?

2 vues (au cours des 30 derniers jours)
htet wai
htet wai le 10 Mai 2018
Commenté : htet wai le 10 Mai 2018
Can you help me how to retrun the larget numbers from the array as in the same order of that array?
for example i have A = 8 , 3, 4 , 1 , 5 , 6 , 2 , 7 , 9. I want to return largest 3 number in the same order as A like that B = 8 , 7 , 9.

Réponse acceptée

ES
ES le 10 Mai 2018
Modifié(e) : ES le 10 Mai 2018
>> [~, idx] = sort(A);
>> B = A(sort(idx(end-2:end))))
  1 commentaire
htet wai
htet wai le 10 Mai 2018
Thank you for your help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by