MATLAB: Deleting specific dublicates out of an array

arraygraphMATLAB

Hi,
I have this problem, I have array like this
B = [1,2] [2,1] [3,4] [3,5] [4,3] [4,5] [5,3] [5,4]
and i cant figure out how to delete dublicates like [1,2] or [2,1].
For example I want to make this array
B = [1,2] [2,1] [3,4] [3,5] [4,3] [4,5] [5,3] [5,4]
To this array
B = [1,2] [3,4] [3,5] [4,5]
Thanks in advance.

Best Answer

I have absolutely no idea what your ‘B’ array actually looks like or how it is constructed.
If the elements of ‘B’ are individual rows, use the unique (link) function with the 'rows' argument. If it is not already a (Nx2) matrix, use the reshape (link) function to get it into an (Nx2) matrix to use unique.