Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Find Duplicates in cellarrays / use of subsindex for cellarrays
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I know how to find the duplicates in cellarrays but how can I reference the cellarray to filter out the duplicated or vice versa get a list with the duplicates etc.?
This is actually what I try to achieve, but the last line doesn't work on cellarrays, so what is the best way in this case? Thank you very much for your help beforehand:
A = {'A',1;'A',2;'B',3}
[C,IA,IC] = unique(A(:,1),'R2012a');
IA(A)
The result should be the following:
X = {'A',1;'B',3}
Y = {'A',2}
0 件のコメント
回答 (2 件)
Honglei Chen
2012 年 10 月 31 日
Is this what you are looking for?
X = A(IA,:)
Y = A(setdiff(1:3,A),:)
0 件のコメント
Andrei Bobrov
2012 年 10 月 31 日
A = {'A',1;'A',2;'B',3};
[b b c] = unique(A(:,1),'first');
out1 = A(b,:);
out2 = A(setdiff(1:numel(c),b),:);
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!