MATLAB Answers

remove rows with duplicates

1 view (last 30 days)
alpedhuez
alpedhuez on 19 Apr 2019
Answered: Walter Roberson on 20 Apr 2019
Consider a following spreadsheet
Column 1 2 3
10 10 10
11 10 9
11 10 10
In this setting I want to delete Row 2 and Row 3 because they have duplicates in Column 1.
More generally, the problem is "I would like to delete any row that has a duplicate in Column 1." Please advise how to proceed

  0 Comments

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 20 Apr 2019
need_to_delete = [false; any(ismember(YourArray(2:end,:), YourArray(1,:)),2)];
YourArray(need_to_delete, :) = [];

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags

Products


Release

R2019a