Find an index of maximum occurring element
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
Maia2022
il 8 Giu 2022
0 voti
Categorie
Scopri di più su Numeric Types in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!