How to find the intersection points in a multidimensional array

23 visualizaciones (últimos 30 días)
RAJASEKAR S
RAJASEKAR S el 17 de Mzo. de 2018
Respondida: KSSV el 22 de Nov. de 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]

Respuestas (1)

KSSV
KSSV el 22 de Nov. de 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, :)

Categorías

Más información sobre Operators and Elementary Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by