Find common elements of two array with repetition????
1 次查看(过去 30 天)
显示 更早的评论
For example
A = [1234567]
B = [2348907]
now i hv to compare above two and want to store index of common elements.
0 个评论
回答(1 个)
Stephen23
2018-9-11
编辑:Stephen23
2018-9-11
[C,ia,ib] = intersect(A,B)
For example:
>> A = [1,2,3,4,5,6,7];
>> B = [2,3,4,8,9,0,7];
>> [C,ia,ib] = intersect(A,B)
C =
2 3 4 7
ia =
2 3 4 7
ib =
1 2 3 7
4 个评论
Image Analyst
2018-9-11
It DOES work. I just copied and pasted and it worked fine. Post the code that you subsequently altered so we can see how your alterations ruined it.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!