필터 지우기
필터 지우기

How to get the most frequent value of vector on Matlab ?

조회 수: 1 (최근 30일)
Makrim
Makrim 2014년 4월 1일
편집: Azzi Abdelmalek 2014년 4월 1일
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).

채택된 답변

Joseph Cheng
Joseph Cheng 2014년 4월 1일
you can use mode()

추가 답변 (1개)

Azzi Abdelmalek
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
Joseph Cheng 2014년 4월 1일
why do this when Matlab already has a function to do this like it does for mean and median?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by