How to print most repeated Value in MATLAB
1 次查看(过去 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 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!