how remove frequent values?

1 view (last 30 days)
huda nawaf
huda nawaf on 17 Nov 2011
hi,
is there a command can remove frequent values from vector?
thanks
  2 Comments
Jan
Jan on 17 Nov 2011
Do you mean repeated values?
huda nawaf
huda nawaf on 17 Nov 2011
yes, the suggestion of Jan is good

Sign in to comment.

Accepted Answer

Jan
Jan on 17 Nov 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 Comments
huda nawaf
huda nawaf on 17 Nov 2011
thanks
I just did sort for x then did unique .
it is good and quick
Walter Roberson
Walter Roberson on 17 Nov 2011
You probably do not need to use both sort _and_ unique: unique does a sort.

Sign in to comment.

More Answers (1)

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

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!