how remove frequent values?

1 次查看(过去 30 天)
huda nawaf
huda nawaf 2011-11-17
hi,
is there a command can remove frequent values from vector?
thanks
  2 个评论
Jan
Jan 2011-11-17
Do you mean repeated values?
huda nawaf
huda nawaf 2011-11-17
yes, the suggestion of Jan is good

请先登录,再进行评论。

采纳的回答

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

请先登录,再进行评论。

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by