MATLAB: Find unique in matrix of x,y coordinates

MATLAB and Simulink Student Suiteunique

Hello, I would love your help.
If I have a matrix of x,y coordinates for example:
x y
A=[ 2.5 3.5
1.2 3.5
2.2 1.2
1.2 3.5
4.0 2.2 ]
How do I find a unique of this? In the above example one instance of x,y (1.2, 3.5) will be removed?

Best Answer

To find unique rows, you can use unique with the 'rows' option. (The 'stable' option preserves the input order, if that's important for your application).
unique(A, 'rows', 'stable')