%% Aggregate Data When Synchronizing Timetables
% Synchronize two timetables to new row times that specify time bins that each span a day. Aggregate the data from the input timetables into the daily time bins.
% Load sample timetables that contain two different sets of environmental measurements, indoors and outdoors. The air quality data come from a sensor inside a building, while the weather measurements come from sensors outside. The timetables include measurements taken from November 15, 2015, to November 19, 2015.

load indoors
load outdoors

%
% Display the first three lines of each timetable. They do not contain the same row times or variables.

indoors(1:3,:)

%

outdoors(1:3,:)

%
% Aggregate the data from the timetables into daily time bins using the synchronize function. Specify 'daily' to aggregate the data into time bins that span one day apiece. Specify 'mean' to obtain the mean values in each time bin for each variable.

TT = synchronize(indoors,outdoors,'daily','mean');
TT(1:3,:)

% Copyright 2012 The MathWorks, Inc.