Info

此问题已关闭。 请重新打开它进行编辑或回答。

remove rows with duplicates

1 次查看(过去 30 天)
alpedhuez
alpedhuez 2019-4-19
关闭: MATLAB Answer Bot 2021-8-20
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

回答(1 个)

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

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by