How to print most repeated Value in MATLAB
2 views (last 30 days)
Show older comments
Med Future on 17 Dec 2022
Answered: Steven Lord on 17 Dec 2022
I have the following array, I want to print the value which is repeated mostly in array.
How can i do that in MATLAB
Steven Lord on 17 Dec 2022
x = randi(5, 6, 6)
mostCommonInColumns = mode(x)
mostCommonInMatrix = mode(x, 'all')
KSSV on 17 Dec 2022
a = [1 2 2 2 3 3 4 4 4] ;
[c,ia,ib] = unique(a);
C = accumarray(ib,1) ;
Voss on 17 Dec 2022
@Med Future: The dataset you have attached contains 492 unique values. That is, there are no repeated values.
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!