1

I'm looking for fastest way to get unique values in matrix with Matlab! I have a matrix like this:

1       2
1       2
1       3
1       5
1       23
2       1
3       1
3       2
3       2
3       2
4       17
4       3
4       17

and need to get something like this:

1       2
1       3
1       5
1       23
2       1
3       1
3       2
4       3
4       17

Actually I need unique values by combination of columns in each row.

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
Sina
  • 575
  • 1
  • 5
  • 23

1 Answers1

5

Have a look at matlabs unique() function with the argument 'rows'.

C = unique(A,'rows')

https://de.mathworks.com/help/matlab/ref/unique.html

user7431005
  • 3,899
  • 4
  • 22
  • 49