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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by