MATLAB: Is it possible to detect repeated values in a matrix?how

MATLABmatrixrepeatedsame

For example I have a matrix such;
A=[5 13 2 7 1 8; 2 4 5 7 8 23 31;5 65 34 12 31 8]
which has a size (nx6)
If we look through first column, first and third row values are same. I just want to detect the repeated values in the 1st column in all rows. How can I do that?
Thanks

Best Answer

This can be done using hist and unqiue. See How can I count the occurrences of each element in a vector in MATLAB? for more information.
A=[5 13 2 7 1 8; 2 4 5 7 8 23;5 65 34 12 31 8];
% Find the unique values
uniqueVals = unique( A(:,1) );
% Count the number of instances of each of the unique vals
valCount = hist( A(:,1) , uniqueVals )';