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!