MATLAB: Count how many times the element occur in a list

finding the maximum value

like i have the following code for the above:
function count
clc;
a=[1 2 3 3 4 5 5 5 5 5 6 6 6 6];
u=unique(a);
for n=1:length(u)
answer(n,:)=[u(n) length(find(a==u(n)))];
end
disp(answer);
end
output is:
1 1
2 1
3 2
4 1
5 5
6 4
i want to find the maximum value from the list (1 1 2 1 5 4) i.e from the 2nd column of the output...
2nd column of output displays the number of times the given element occurs.
can anyone tell me how to solve it?

Best Answer

[maxcount, maxidx] = max(answer(:,2));
answer(maxidx,1), 'occurred', maxcount