How to determine the index of two smallest probability in a vector

1 vue (au cours des 30 derniers jours)
fyza affandi
fyza affandi le 19 Nov 2018
Commenté : fyza affandi le 19 Nov 2018
I have a vector A
A=[0.7188 0.0625 0.0625 0.0469 0.0313 0.0156 0.0156 0.0156 0.0156 0.0156]
How can I find the two smallest probabilities and result only the index .The result will be :-
b=[9 10]

Réponse acceptée

madhan ravi
madhan ravi le 19 Nov 2018
Modifié(e) : madhan ravi le 19 Nov 2018
A=[0.7188 0.0625 0.0625 0.0469 0.0313 0.0156 0.0156 0.0156 0.0156 0.0156]
index = find(ismember(A,min(A)))
b = index(end-1:end)
  7 commentaires
madhan ravi
madhan ravi le 19 Nov 2018
Asking in the forum is better , if you have a question post a separate question .
fyza affandi
fyza affandi le 19 Nov 2018
Okay sir. Thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by