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