how remove frequent values?

1 visualización (últimos 30 días)
huda nawaf
huda nawaf el 17 de Nov. de 2011
hi,
is there a command can remove frequent values from vector?
thanks
  2 comentarios
Jan
Jan el 17 de Nov. de 2011
Do you mean repeated values?
huda nawaf
huda nawaf el 17 de Nov. de 2011
yes, the suggestion of Jan is good

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 17 de Nov. de 2011
x = floor(rand(1, 100)*10);
[N, Bin] = histc(x, unqiue(x));
Now you can use sort(N) to find the most frequent elements. Then you can search the corrsponding indices in Bin.
  2 comentarios
huda nawaf
huda nawaf el 17 de Nov. de 2011
thanks
I just did sort for x then did unique .
it is good and quick
Walter Roberson
Walter Roberson el 17 de Nov. de 2011
You probably do not need to use both sort _and_ unique: unique does a sort.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 17 de Nov. de 2011
To remove the most frequent value, and assuming it is a vector you are working with:
x(x==mode(x)) = [];

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by