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