MATLAB: Most Frequent letter in a Matrix. Help Please!

lettersmatrixmost frequent

Good night all,
I have a group of letters in a matrix, now I want to get a new matrix with the most frequent letter in groups of 4 rows.
So I have a matrix like this;
A
AB
AB
AB
B
B
B
B
(…)
and I want this;
AB
B
(…)
I'm reading the matrix with
[~,txt] = xlsread('Cópia de 2012_15min.xls','JAN','B25:B3000');
and I already tried
res = char( mode( double( reshape( txt, 4, [ ] ) ) ) )
but I'm getting an error
??? Error using ==> double Too many input arguments.
Error in ==> Untitled at 37 res = char( mode( double( txt, 4, [ ] ) ) )

Best Answer

% Create sample data
letters = {...
'A'
'AB'
'AB'
'AB'
'B'
'B'
'B'
'B'}
% Now find unique letter pairs
uniqueLetters = unique(letters)