Here's a list of all the ways I could think of to counting unique elements:
M = randi([1 7], [1500 1]);
Option 1: tabulate
t = tabulate(M);
counts1 = t(t(:,2)~=0, 2);
Option 2: hist/histc
counts2_1 = hist( M, numel(unique(M)) );
counts2_2 = histc( M, unique(M) );
Option 3: accumarray
counts3 = accumarray(M, ones(size(M)), [], @sum);
%# or simply: accumarray(M, 1);
Option 4: sort/diff
[MM idx] = unique( sort(M) );
counts4 = diff([0;idx]);
Option 5: arrayfun
counts5 = arrayfun( @(x)sum(M==x), unique(M) );
Option 6: bsxfun
counts6 = sum( bsxfun(@eq, M, unique(M)') )';