Note: This page has been translated by MathWorks. Please click here

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Synchronize timetables to common time vector, and resample or aggregate data from input timetables

The `synchronize`

function collects
the variables from all input timetables, synchronizes them to a common
time vector, and returns the result as a single timetable. The effect
is similar to a horizontal concatenation, though the input timetables
can have different row times. When the `synchronize`

function
synchronizes timetable variables to different times, it also resamples
or aggregates the data in the variables using a method that you specify.

`TT = synchronize(TT1,TT2)`

`TT = synchronize(TT1,TT2,newTimeBasis,method)`

`TT = synchronize(TT1,TT2,newTimeStep,method)`

`TT = synchronize(TT1,TT2,newTimes,method)`

`TT = synchronize(TT1,TT2,newTimeBasis)`

`TT = synchronize(TT1,TT2,newTimeStep)`

`TT = synchronize(TT1,TT2,newTimes)`

`TT = synchronize(TT1,TT2,___,Name,Value)`

`TT = synchronize(TT1,...,TTN,___)`

`TT = synchronize(`

creates
a timetable, `TT1,TT2`

)`TT`

, that contains all variables from
both the input timetables `TT1`

and `TT2`

,
synchronized to a vector of row times that is the union of the row
times from `TT1`

and `TT2`

. The
row times of `TT`

are in sorted order with no repeated
times.

In effect, `synchronize`

horizontally concatenates
the variables of `TT1`

and `TT2`

,
even when they have row times that differ. As a result, `synchronize`

inserts
a missing data indicator in `TT`

wherever it has:

A row time only from

`TT1`

but no corresponding data from the variables of`TT2`

.A row time only from

`TT2`

but no corresponding data from the variables of`TT1`

.

If `TT1`

and `TT2`

have variables
with the same names, then `synchronize`

renames them
and copies both variables into `TT`

.

To interpolate or fill in values in `TT`

using different
methods for different variables, specify the
`VariableContinuity`

property of each input timetable. For
more information, see Retime and Synchronize Timetable Variables Using Different Methods.

`TT = synchronize(`

creates `TT1,TT2`

,`newTimeBasis`

,`method`

)`TT`

by
synchronizing the variables from `TT1`

and `TT2`

to
a new time vector specified by `newTimeBasis`

. `synchronize`

resamples
or aggregates data from the variables in `TT1`

and `TT2`

using
the operation specified by `method`

. The input argument, `newTimeBasis`

,
specifies how `synchronize`

constructs the row times
of `TT`

from the row times of `TT1`

and `TT2`

.

For example, if `newTimeBasis`

is `'union'`

and `method`

is `'linear'`

,
then `TT`

contains the row times from `TT1`

and `TT2`

,
and `synchronize`

uses linear interpolation to resample
the data from the input timetables to the output row times.

`TT = synchronize(`

creates `TT1,TT2`

,`newTimeStep`

,`method`

)`TT`

by
synchronizing the variables from `TT1`

and `TT2`

to
a new time vector that is regularly spaced by the time unit specified
by `newTimeStep`

.

For example, if `newTimeStep`

is `'daily'`

and `method`

is `'mean'`

,
then `TT`

contains row times that are one day apart,
and `TT`

contains daily means for each variable from `TT1`

and `TT2`

.

`TT = synchronize(`

creates `TT1,TT2`

,`newTimeBasis`

)`TT`

by
synchronizing the variables from `TT1`

and `TT2`

to
a new time vector. `synchronize`

inserts missing
data indicators where needed in `TT`

.

`TT = synchronize(`

creates `TT1,TT2`

,`newTimeStep`

)`TT`

by
synchronizing the variables from `TT1`

and `TT2`

to
a new time vector that is regularly spaced by the time unit specified
by `newTimeStep`

. The `synchronize`

function
inserts missing data indicators where needed in `TT`

.

`TT = synchronize(`

synchronizes
timetables with additional options specified by one or more `TT1,TT2`

,___,`Name,Value`

)`Name,Value`

pairs.
You can use this syntax with the input arguments of any of the previous
syntaxes.

`TT = synchronize(TT1,...,TTN,___)`

creates
the timetable, `TT`

, by synchronizing the `N`

timetables `TT1,...,TTN`

.
You can use this syntax with the input arguments of any of the previous
syntaxes.

Was this topic helpful?