MATLAB Answers

How can I strip duplicates?

28 views (last 30 days)
Holm Roeser
Holm Roeser on 8 Apr 2021
Answered: Fangjun Jiang on 9 Apr 2021 at 19:46
I wish to remove all duplicate rows based off of the first column. That is, I want to just strip the excess away. I am struggling to understand how to implement "unique" here. Thanks in advance
Cris LaPierre
Cris LaPierre on 9 Apr 2021 at 19:15
Ah, got it. Thanks.

Sign in to comment.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 9 Apr 2021 at 19:46
If you want
  1. remove duplicates only based on values in the first column
  2. Do not want the returned values be sorted
then you need to do this
[~, index]=unique(in(:,1),'stable');




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!