Effacer les filtres
Effacer les filtres

how to know the indices of multiple max values?

22 vues (au cours des 30 derniers jours)
Jaybee
Jaybee le 1 Oct 2013
hi there!
I'm having problem about identifying the indices(position) of a multiple max values.
example of input:
A=[4 5 9 9]
how can i know the indices of those 9's?

Réponse acceptée

Wayne King
Wayne King le 1 Oct 2013
Modifié(e) : Wayne King le 1 Oct 2013
One way:
A = [4 5 9 9];
maxval = max(A);
lia = ismember(A,maxval);
idx = find(lia);
or shorter
maxval = max(A);
idx = find(A == maxval);
  2 commentaires
Jaybee
Jaybee le 1 Oct 2013
thank you so much bro :)
vimal kumar chawda
vimal kumar chawda le 9 Juil 2021
what if we have matrix?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays 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