How to find the intersection points in a multidimensional array

23 ビュー (過去 30 日間)
RAJASEKAR S
RAJASEKAR S 2018 年 3 月 17 日
回答済み: KSSV 2020 年 11 月 22 日
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]

回答 (1 件)

KSSV
KSSV 2020 年 11 月 22 日
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, :)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by