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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!