timerange
Time 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, or character vectors or strings that specify dates and
times.
If startTime
and endTime
are datetime
values, then you only can use S
to subscript into a timetable
whose row times are datetime values. Similarly, if startTime
and endTime
are duration values, then you only can use
S
to subscript into a timetable whose row times are
duration values.
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)