Find an index of maximum occurring element
    5 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Maia2022
 le 7 Juin 2022
  
    
    
    
    
    Réponse apportée : Maia2022
 le 8 Juin 2022
            Hi,
I'd like to find the value tht has the maximum occurence is a array
Ex: A = [ 1 2 3 1 1 6 3 4 2 2 1 1 1 ];
   x = unique(A);
   N = numel(x);
[u, ~, uidx] = unique(A(:));
counts = accumarray(uidx, 1);
Those solutions give the number of occurences but I'd like to get the indices and the values of that value with max occurrences.
Thank you
0 commentaires
Réponse acceptée
Plus de réponses (1)
Voir également
Catégories
				En savoir plus sur Downloads 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!

