MATLAB: How to find the frequency of each row with certain coordiante in a matrix

MATLABmatrix

Hello all,
I have an mx2 matrix with its rows (0,1), (-1,0), (0,1), (0,-1), (1,1), (-1,1), (1,-1),(-1,-1); I would like to find the frequency of each of above coordinates. In other words, if I have A=[1 1;0 1;-1 1;1 0;-1 1], I would like to get something like,
number of times that (1,1) has appeared=1; number of times that (0,1) has appeared=1; number of times that (-1,1) has appeared=2; number of times that (1,0) has appeared=1; number of times that (0,-1) has appeared=0; number of times that (-1,-1) has appeared=0; number of times that (-1,0) has appeared=0; number of times that (1,-1) has appeared=0;
when I use "find" command I get an error. Thank you.

Best Answer

A=[1 1; 0 1; 1 0; -1 1;-1 1;0 1;0 1]
[ii,jj,kk]=unique(A,'rows','stable')
f=histc(kk,1:numel(jj)); % Frequency
result=[ii f]