Any hints on best way to get frequency of items in a matrix? i.e. if you have:

x={1 1 2 2 2 3 3 4 5 6 6 6 6 6};

then something like;
y=imlfreq(x);

and result would be:
{1 2,
2 3,
3 2,
4 1,
5 1,
6 5};

i.e. two columns, first is the element value second is the count of apperances in x.

I can get there with a function that loops over the unique values of X, but that seem cumbersome.
Thanks!
Jim