how remove frequent values?
1 view (last 30 days)
Show older comments
hi,
is there a command can remove frequent values from vector?
thanks
2 Comments
Accepted Answer
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
Walter Roberson
on 17 Nov 2011
You probably do not need to use both sort _and_ unique: unique does a sort.
More Answers (1)
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)) = [];
0 Comments
See Also
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!