How to print most repeated Value in MATLAB
조회 수: 2 (최근 30일)
이전 댓글 표시
I have the following array, I want to print the value which is repeated mostly in array.
How can i do that in MATLAB
댓글 수: 0
답변 (2개)
Steven Lord
2022년 12월 17일
x = randi(5, 6, 6)
mostCommonInColumns = mode(x)
mostCommonInMatrix = mode(x, 'all')
댓글 수: 0
KSSV
2022년 12월 17일
a = [1 2 2 2 3 3 4 4 4] ;
[c,ia,ib] = unique(a);
C = accumarray(ib,1) ;
[c' C]
댓글 수: 3
Voss
2022년 12월 17일
@Med Future: The dataset you have attached contains 492 unique values. That is, there are no repeated values.
load reprctedvalue
numel(clusters1)
numel(unique(clusters1))
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!