Resample or aggregate data in timetable, and resolve duplicate or irregular times
TT2 = retime(
returns a timetable that contains the variables fromTT1
,newTimeStep
,method
)TT1
and row times that are regularly spaced by the time stepnewTimeStep
. Theretime
function resamples or aggregates data in the variables ofTT1
using the function specified bymethod
. You can useretime
to:
Interpolate data values fromTT1
at different times.
Aggregate data into time bins (for example, to create a timetable containing quarterly means from monthly data).
Remove rows fromTT1
that have duplicate row times.
Make an irregular timetable into a regular timetable, sincenewTimeStep
specifies regular row times.
ThenewTimeStep
那输入向量参数是一个字符或字符串t specifies a predefined time step. For example, whennewTimeStep
is'daily'
, andmethod
is'mean'
, thenTT2
contains the daily means of the data fromTT1
.
The first row time ofTT2
is on the time step before the earliest row time fromTT1
. The row times inTT2
cover the range of row times fromTT1
. However,TT2
might not include any of the actual row times fromTT1
, sinceTT1
might not have any row times that fall on any of the regular row times ofTT2
.
To interpolate or fill in values inTT2
using different methods for different variables, specify theVariableContinuity
property ofTT1
. For more information, seeRetime and Synchronize Timetable Variables Using Different Methods.
To resample or aggregate data from multiple timetables, seesynchronize
.
TT2 = retime(
calculates regularly spaced row times using the time stepTT1
,'regular',method
,'TimeStep',dt
)dt
. Thedt
input argument is a scalar duration or calendar duration, specifying a time step of any size. The row times ofTT2
span the range of row times ofTT1
.
Use this syntax when the time step is not one of the predefined time steps you can specify as a character vector or string.
TT2 = retime(
adjusts the timetable variables data to the time vectorTT1
,newTimes
,method
)newTimes
, using the method specified bymethod
. ThenewTimes
time vector can be irregular, but it must be a sorted datetime or duration vector and contain unique values. The times innewTimes
become the row times ofTT2
.
TT2 = retime(
adjusts timetable data using theTT1
,newTimeStep
)'fillwithmissing'
method.TT2
has missing data indicators whereverTT2
has a row time that does not match any row time inTT1
.
IfTT1
has rows with duplicate row times andTT2
has row times that match the duplicates, thenTT2
contains the first row from each group of rows inTT1
with duplicate row times that match.
TT2 = retime(___,
adjusts timetable data using additional options specified by one or moreName,Value
)Name,Value
pairs. You can use this syntax with the input arguments of any of the previous syntaxes.
innerjoin
|synchronize
|outerjoin
|horzcat
|vertcat
|lag
|resample
|resample
(Signal Processing Toolbox)|Retime Timetable|Synchronize Timetables