I have two tables T1 and T2 with identical number of columns but different number of raw.
The x,y,z columns from both tables were created as below:
clear all;close all;XSTART=5;XEND=20;YSTART=5;YEND=15;STEP1=1;STEP2=5;%******************* CREATE TABLE1 ********************
xvector1 = XSTART:STEP1:XEND;yvector1 = YSTART:STEP1:YEND;numX1 = numel(xvector1); numY1 = numel(yvector1);yvector1 = repmat(yvector1(:),numX1,1);xvector1 = repmat(xvector1 ,numY1,1);COORDINATES1= [xvector1(:) yvector1];VALUE1=(1:1:numX1*numY1)';VALUE1(1:end,1)=10;T1=[COORDINATES1 VALUE1];%******************* CREATE TABLE2 ********************
xvector2 = XSTART:STEP2:XEND;yvector2 = YSTART:STEP2:YEND;numX2 = numel(xvector2); numY2 = numel(yvector2);yvector2 = repmat(yvector2(:),numX2,1);xvector2 = repmat(xvector2 ,numY2,1);COORDINATES2= [xvector2(:) yvector2];VALUE2 =(1:numX2*numY2)';T2=[COORDINATES2 VALUE2];
Now I want to create a table T3 replacing the values of the third column from T1 by the values of the third column from T2 with the same x,y- coordinate.
The expected T3 after proper substitution will have the following components:
5 5 15 6 105 7 105 8 105 9 105 10 25 11 105 12 105 13 105 14 105 15 36 5 106 6 106 7 106 8 106 9 106 10 106 11 106 12 106 13 106 14 106 15 107 5 107 6 107 7 107 8 107 9 107 10 107 11 107 12 107 13 107 14 107 15 108 5 108 6 108 7 108 8 108 9 108 10 108 11 108 12 108 13 108 14 108 15 109 5 109 6 109 7 109 8 109 9 109 10 109 11 109 12 109 13 109 14 109 15 1010 5 410 6 1010 7 1010 8 1010 9 1010 10 510 11 1010 12 1010 13 1010 14 1010 15 6
and so on.
I hope someone knows how to do it.
Thanks in advance for your help
Emerson
Best Answer