MATLAB: Replacing the strings with a specific length in a cell

cell arraycellfunlengthreplacestring

I want to replace the strings with lenght>=3 with 'm' in the second column of the following cell(without using a loop). So I want to get b from a. Any suggestion? thanks a lot
a =
'1' 'aaaa'
'2' 'a'
'3' 'aa'
'4' 'aaa'
b =
'1' 'm'
'2' 'a'
'3' 'aa'
'4' 'm'

Best Answer

n = 3;
idx = cellfun('prodofsize',a(:,2)) >= n;
a(idx, 2) = {'m'};
Note, however that cellfun is a concealed loop.