MATLAB: Remove duplicates from vector

MATLABvector

Hello
I have a 2xN vector where each column represent the x and y coordinates of a 2D point. I need to remove any duplicate point from this vector, any suggestions?
Best regards MC

Best Answer

It is trivial to use unique to get only the unique rows of matrix. Because your matrix is arranged 2xN, simply transpose before and after:
unique(M.','rows').'