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

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

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

Resample or aggregate data in timetable, and resolve duplicate or irregular times

`TT2 = retime(TT1,newTimeStep,method)`

`TT2 = retime(TT1,newTimes,method)`

`TT2 = retime(TT1,newTimeStep)`

`TT2 = retime(TT1,newTimes)`

`TT = retime(___,Name,Value)`

`TT2 = retime(`

creates
a timetable that contains the variables from `TT1`

,`newTimeStep`

,`method`

)`TT1`

and
row times that are regularly spaced by the time step specified by `newTimeStep`

. `retime`

resamples
or aggregates data from the variables of `TT1`

using
the function specified by `method`

. You can use `retime`

to:

Interpolate data values from

`TT1`

at different times.Aggregate data into time bins (for example, to create a timetable containing quarterly means from monthly data).

Remove rows from

`TT1`

that have duplicate row times.Make an irregular timetable into a regular timetable, since

`newTimeStep`

specifies regular row times.

For example, when `newTimeStep`

is `'daily'`

,
and `method`

is `'mean'`

, then `TT2`

contains
the daily means of the data from `TT1`

.

The first row time of `TT2`

is on the time
step before the earliest row time from `TT1`

. The
row times in `TT2`

cover the range of row times from `TT1`

.
However, `TT2`

might not include any of the actual
row times from `TT1`

, since `TT1`

might
not have any row times that fall on any of the regular row times of `TT2`

.

To resample or aggregate data from multiple timetables, see `synchronize`

.

`TT2 = retime(`

creates
a timetable that contains the variables from `TT1`

,`newTimes`

,`method`

)`TT1`

and
adjusts their data to the time vector `newTimes`

,
using the method specified by `method`

. The `newTimes`

time
vector must be a sorted datetime or duration vector and contain unique
values. The times in `newTimes`

become the row times
of `TT2`

.

`TT2 = retime(`

creates
a timetable using the `TT1`

,`newTimeStep`

)`'fillwithmissing'`

method. `TT2`

has
missing data indicators wherever `TT2`

has a row
time that does not match any row time in `TT1`

.

If `TT1`

has rows with duplicate row times
and `TT2`

has row times that match the duplicates,
then `TT2`

contains the first row from each group
of rows in `TT1`

with duplicate row times that match.

`TT2 = retime(`

creates
a timetable using the `TT1`

,`newTimes`

)`'fillwithmissing'`

method. `TT2`

contains
missing data indicators wherever `newTimes`

does
not match row times in `TT1`

.

If `TT1`

has rows with duplicate row times
and `newTimes`

has times that match the duplicates,
then `TT2`

contains the first row from each group
of rows in `TT1`

with duplicate row times that match.

`TT = retime(___,`

creates
a timetable with additional options specified by one or more `Name,Value`

)`Name,Value`

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

Was this topic helpful?