MATLAB: Finding Indices of Duplicate Values

indicesunique

Suppose, I have a variable,
a{1}=[
2 2 1 3
5 2 1 1
5 2 1 4
5 2 1 2
1 1 2 1
2 2 2 1
1 1 3 4
1 1 3 3
4 1 3 5
1 1 4 3
1 1 4 4
1 1 4 1
2 2 4 1
2 2 4 2
4 1 4 2
4 1 4 6
2 2 5 2
2 2 5 6
4 1 5 1
4 1 5 2
4 1 5 6
4 1 5 5]
How can I find the indices of duplicate values for column 3:4?
I am using Matlab R2013a. Thank you in advance.

Best Answer

Hi!
You may use "unique". The second output is the index of all unique values, e.g. in column 3. All other indices are duplicates.