How to find the intersection points in a multidimensional array

22 Ansichten (letzte 30 Tage)
RAJASEKAR S
RAJASEKAR S am 17 Mär. 2018
Beantwortet: KSSV am 22 Nov. 2020
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]

Antworten (1)

KSSV
KSSV am 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, :)

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by