timerange
R2026bTime range for timetable row subscripting
Syntax
Description
S = timerange(
creates a subscript to select rows of a timetable within a range of times.
startTime,endTime)S selects all rows whose times are in the time interval
specified by startTime and endTime,
including startTime but not endTime. In
other words, the time interval is a half-open interval.
startTime and endTime are datetime or
duration scalars, character vectors or strings that specify dates and times, or
numeric scalars.
startTime and endTime must be of the
same type and match the type of the timetable row times:
If they are
datetime(or text representing datetimes) values, then you only can useSto subscript into a timetable withdatetimerow times.If they are
durationvalues, then you only can useSto subscript into a timetable withdurationrow times.If they are numeric (
doubleorsingle) values, then you only can useSto subscript into a timetable with numeric row times. The timetable row times,startTime, andendTimemust all be eitherdoubleorsinglevalues.
S = timerange(
creates a subscript over the type of interval specified by
startTime,endTime,intervalType)intervalType. For example, if
intervalType is 'closed', then
S includes both startTime and
endTime in the time range it specifies.
S = timerange(
creates a subscript over the time period between startPeriod,endPeriod,datetimeUnit)startPeriod
and endPeriod, using the date or time component specified by
datetimeUnit. For example, if
datetimeUnit is 'months', then
S includes the start of the month that is a component of
startPeriod, and the end of the month of
endPeriod. The inputs startPeriod and
endPeriod can be datetime scalars, or if text, they can
be character vectors or strings that specify dates and times.
S = timerange(
creates a subscript spanning the beginning and end of
timePeriod,datetimeUnit)timePeriod, using the date or time component specified by
datetimeUnit. For example, if
datetimeUnit is 'day', then
S includes the start and end of the day that is a
component of timePeriod. The input
timePeriod can be a datetime scalar, or if text, it can
be a character vector or string that specifies a time period.
S = timerange( creates
a row subscript using a pair of event filters. To use event filters, the
timetable you subscript into must have an attached event table. For more
information on specifying a time range using event filters, see startEF,endEF)eventfilter. (since R2023a)