How to delete all repeat rows?
조회 수: 1 (최근 30일)
이전 댓글 표시
채택된 답변
Rik
2020년 5월 19일
편집: Rik
2020년 5월 19일
There is probably a more efficient way, but you can use unique() to get all first occurrences. Then you can use the second output to find all removed rows, which you can use as an input to setdiff.
A=[0 4;2 4;0 4;4 8;3 4;0 4];
[B,ind]=unique(A,'stable','rows');
ind=setdiff(1:size(A,1),ind);
B=setdiff(B,A(ind,:),'rows');
댓글 수: 4
Rik
2020년 5월 22일
Glad to be of help. If it solved your problem, please consider marking it as accepted answer. If not, feel free to comment with your remaining issues.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!