필터 지우기
필터 지우기

frequency determination

조회 수: 4 (최근 30일)
Mohammad Golam Kibria
Mohammad Golam Kibria 2011년 5월 8일
Hi I have a matrix as follows:
A=[1 2 3; 2 3 2; 1 2 3]
I need to determine the frequency of the matrix value. i.e.
the frequency of 1 is 2 the frequency of 2 is 4 the frequency of 3 is 3
How to do this easily.

채택된 답변

Oleg Komarov
Oleg Komarov 2011년 5월 8일
c = histc(A(:),unique(A))
  댓글 수: 3
Oleg Komarov
Oleg Komarov 2011년 5월 8일
Didn't notice the ; in your A. Edited above.
Teja Muppirala
Teja Muppirala 2011년 5월 8일
A similar alternative:
[counts,values] = hist(A(:),unique(A))

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by