Azzera filtri
Azzera filtri

How to count tha maximum frequency of an element in a matrix/ array?

2 visualizzazioni (ultimi 30 giorni)
for example if I have an array
x=[1,3,4,2,2,1,1,1,1]
I want to know what is the frequency of each element in the array.
thank you,
  2 Commenti
madhan ravi
madhan ravi il 7 Gen 2019
you haven’t responded to the previous question , is it similar?
aya qassim
aya qassim il 7 Gen 2019
Sorry,I did not notice that you have answered.
I will see now.

Accedi per commentare.

Risposte (1)

KSSV
KSSV il 7 Gen 2019
x=[1,3,4,2,2,1,1,1,1] ;
[c,ia,ib] = unique(x) ;
h = hist(ib) ;
[c' h(h>0)']

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by