MATLAB: How to combine multiple time spans in Matlab

combining tablesMATLAB

I have data from multiple .txt files, each displaying temperature at different times throughout the day. Each .txt file is for one day. I want to combine all these dates and their respective recorded temperatures into one table, so that I can plot for a very large time duration, i.e. 3 months, etc.
Suppose I collect the data for 3 days.
Day1 = 'SI010218.log';
Day2 = 'SI020218.log';
Day3 = 'SI030218.log';
opts = detectImportOptions(Day1);
opts = setvartype(opts,1,'datetime');
opts = setvaropts(opts,1,'InputFormat','dd.MM.uuuu HH:mm:ss');
table1 = readtable(Day1,opts);
opts = detectImportOptions(Day2);
opts = setvartype(opts,1,'datetime');
opts = setvaropts(opts,1,'InputFormat','dd.MM.uuuu HH:mm:ss');
table2 = readtable(Day2,opts);
table2([1417],:) = [];
opts = detectImportOptions(Day3);
opts = setvartype(opts,1,'datetime');
opts = setvaropts(opts,1,'InputFormat','dd.MM.uuuu HH:mm:ss');
table3 = readtable(Day3,opts);
This creates 3 tables holding all the data from each of the .txt files. Column 1 holds the date and time, and column 8 holds the desired y-axis values. How do I add all the time values from column 1 into a separate table along with the y axis value placed in column 8? I am attaching the .txt files as well.

Best Answer

Not sure what your end goal is but if you'd like to bring the variables of the table together, you can try the following in addition to your current code:
>> table1.Properties.VariableNames{'TimeStamp'} = 'TimeStamp_1';
>> table2.Properties.VariableNames{'TimeStamp'} = 'TimeStamp_2';
>> table3.Properties.VariableNames{'TimeStamp'} = 'TimeStamp_3';
>> tt = [table1(:,1), table2(:,1), table3(:,1)]; %variables next to each other
If you would like to stack data from multiple variables into single variable:
>> st = stack(tt,1:3);
This can be done with column 8 data (y-axis) as well and I suppose you could then plot the data.