Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
aya qassim
aya qassim el 7 de En. de 2019
Comentada: aya qassim el 7 de En. de 2019
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 comentarios
madhan ravi
madhan ravi el 7 de En. de 2019
you haven’t responded to the previous question , is it similar?
aya qassim
aya qassim el 7 de En. de 2019
Sorry,I did not notice that you have answered.
I will see now.

Iniciar sesión para comentar.

Respuestas (1)

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

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by