I tried Matlab and the net to find an answer but in vain so I need your help I have used the code below to find number of occurrences of the letters in an array;
characterCell = {'a' 'b' 'b' 'a' 'b' 'd' 'c' 'c'}; %# Sample cell array
matchCell = {'a' 'b' 'c' 'd' 'e'}; %# Letters to count
[~,index] = ismember(characterCell,matchCell); %# Find indices in matchCell
counts = accumarray(index(:),1,[numel(matchCell) 1]); %# Accumulate indices
results = [matchCell(:) num2cell(counts)] `
results =
'a' [2] 'b' [3] 'c' [2] 'd' [1] 'e' [0]
Now I need to get which letter has the highest occurrence How to know the index?