Matlab MODE-like function for evaluating multimodal sets of data?

조회 수: 3 (최근 30일)
I read up what I could find on matlab MODE() function and I don't see any formatting options to make it return multiple modes.
If we have a data set A = [1,2,3,3,5,2,7,7]
[2,3,7] all occur 2 times making it a multimodal data set
matlab can only return the smallest mode value, 2.
http://www.mathworks.com/help/matlab/ref/mode.html
Is there another function that can handle multiple modes?
Right now I am resorting to the tabulate() function and some manipulation to get the values I want out but I am really hoping there is a simpler way :(
thanks

채택된 답변

Teja Muppirala
Teja Muppirala 2012년 10월 12일
One fairly simple way to do it:
A = [1,2,3,3,5,2,7,7];
U = unique(A);
H=histc(A,U);
U(H==max(H))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Wavelet Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by