MATLAB Answers

0

How to cut duplicate rows from a matrix

Asked by John Hunt on 13 Oct 2017
Latest activity Edited by Cedric Wannaz
on 13 Oct 2017
I have a matrix that has 60,000+ rows and there are duplicate of rows in this matrix example: [1 2 3; 1 2 3; 2 3 3; 2 3 3] How can I get a matrix that just has [1 2 3; 2 3 3]?

  0 Comments

Sign in to comment.

1 Answer

Answer by Cedric Wannaz
on 13 Oct 2017
Edited by Cedric Wannaz
on 13 Oct 2017
 Accepted Answer

A_uniqueRows = unique( A, 'rows' ) ;
or
A_uniqueRows = unique( A, 'rows', 'stable' ) ;
if you don't want the output to be sorted.

  0 Comments

Sign in to comment.