How can I delete duplicates in an array, with exceptions?
이전 댓글 표시
I have an array which I would like to delete only the 2nd duplicate of a set in an array e.g:
'B1(46)'
'B13(201)'
'B14(201)'
'B14(201)' - delete
'B1(52)'
'B2(52)'
'B2(52)' - delete
'B5(124)'
'B6(124)'
'B6(124)' - delete
'B13(201)'
'B14(201)'
'B14(201)' - delete
My current script (below) will delete all duplicates of 'B14(201)', which is not what I want:
wd=event; % with duplicates
[~,idx]=unique(strcat(wd()),'stable');
newevent=wd(idx); %without duplicates
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!