matlab - How to "Align" datasets with missing intervals -


let's have 2 sets of data intervals of 0.5 units apart within range 0.0 - 3.0

dataset 1:  x  |  y1         dataset 2:  x  | y2            ---------                    ---------                    0.0   5                      0.0   2             0.5   3                      0.5   6             2.0   7                      1.0   9             3.0   1                      2.5   1                                          3.0   4 

what efficient way align these data tables can make single table containing both datasets , autofill missing components?

ideally end result this:

dataset 3: x  |  y1  |  y2           -----------------           0.0    5      2           0.5    3      6           1.0    0      9           1.5    0      0           2.0    7      0           2.5    0      1           3.0    1      4 

since know x looks like, can create output dataset , fill in values y1 , y2

x = 0:0.5:3; data3 = [x', zeros(length(x),2)];  %# "wherever x matches first column of data1/2, copy second column data3(ismember(x,data1(:,1)),2) = data2(:,1); data3(ismember(x,data2(:,1)),3) = data2(:,2); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -