How to get the most frequent value of vector on Matlab ?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a vector A that contains let say [1,2,2,4]. I am looking for a way to get the most frequent value on A (here 2).
댓글 수: 0
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2014년 4월 1일
편집: Azzi Abdelmalek
2014년 4월 1일
A=[1,2,2,4]
b=unique(A);
f=hist(A,b)
[~,idx]=max(f)
out=b(idx)
댓글 수: 1
Joseph Cheng
2014년 4월 1일
why do this when Matlab already has a function to do this like it does for mean and median?
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!