How to find the intersection points in a multidimensional array
23 views (last 30 days)
Show older comments
A=4X2X10;B=4X2X10;(array size of A and B) how to find intersect points between A and B eg like this _ _ *
I=(4X2X10)(array size of I)
I=intersect(A(:,:,1),B(:,:,1),'rows'
for eg A(:,:,1)=[4 5; 7 8;1 0; 6 3] and B=(:,:,1)=[8 9;4 5;2 8;6 3] I(:,:,1)=[4 5;6 3]
0 Comments
Answers (1)
KSSV
on 22 Nov 2020
Read about ismember. You can use ismemebrfor each marix by running a loop. For the present given matrices:
A (:,:, 1) = [4 5; 7 8; 1 0; 6 3];
B (:,:, 1) = [8 9; 4 5; 2 8; 6 3];
[c, ia] = ismember (A, B, 'rows' );
I = A (c, :)
0 Comments
See Also
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!