identify the coordinates of a point P (1x3) in three distinct matrices

1 回表示 (過去 30 日間)
Alberto Acri
Alberto Acri 2023 年 10 月 5 日
回答済み: Fabio Freschi 2023 年 10 月 5 日
HI! I should identify an identical point P (1x3) within the 3 matrices and in the first 3 columns of these 3 matrices.
For example, given the three matrices A,B,C, the common point (identical point) would be P.
A = [28.0445 -17.2717 83.972 1 2 3
27.8199 -16.986 83.3748 4 5 6
27.2756 -16.339 81.871 7 8 9
25.3805 -14.0329 67.019 10 11 12];
B = [25.3805 -14.0329 67.019 13 14 15
25.3425 -14.0698 66.0921 16 17 18
25.2731 -14.1203 65.1073 19 20 21
25.1719 -14.1617 64.1436 22 23 24];
C = [25.3805 -14.0329 67.019 25 26 27
26.2863 -14.4669 67.2675 28 29 30
27.0031 -14.7142 67.6157 31 32 33
27.7458 -14.9233 68.1745 34 35 36];
P = [25.3805 -14.0329 67.019];

採用された回答

Fabio Freschi
Fabio Freschi 2023 年 10 月 5 日
You can use ismember
% data
A = [28.0445 -17.2717 83.972 1 2 3
27.8199 -16.986 83.3748 4 5 6
27.2756 -16.339 81.871 7 8 9
25.3805 -14.0329 67.019 10 11 12];
B = [25.3805 -14.0329 67.019 13 14 15
25.3425 -14.0698 66.0921 16 17 18
25.2731 -14.1203 65.1073 19 20 21
25.1719 -14.1617 64.1436 22 23 24];
C = [25.3805 -14.0329 67.019 25 26 27
26.2863 -14.4669 67.2675 28 29 30
27.0031 -14.7142 67.6157 31 32 33
27.7458 -14.9233 68.1745 34 35 36];
% engine
idx = ismember(A(:,1:3),B(:,1:3),'rows') & ismember(A(:,1:3),C(:,1:3),'rows')
P = A(idx,1:3)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by