MATLAB: Most frequent word in cell array

cell arraysText Analytics Toolboxword count

Hi, I have a cell array "P" of size 2000 by 20. Each cell value is either "Yes" or "No". How can I make a new cell array "vote" of size 2000 by 1 that each cell contains the most frequent word of each row in P?

Best Answer

tf = ismember(lower(P), 'yes');
votes = sum(tf, 2);