containsrange

Tests whether a timetable spans a given time range.

Category: Language Fundamentals > Data Types

Syntax

tf = containsrange(TT, timeRange)

True if the row times of TT cover the whole of timeRange.

Description

The test compares the first and last row times of the timetable with the ends of the range. It is true when the earliest time is not after the start of the range and the latest time is not before its end. It does not need a row to fall exactly at either end.

Related tests are withinrange, true if the whole timetable lies inside the range, and overlapsrange, true if they share any time.

Input arguments

TT
timetable.
timeRange
A timerange object, or a two-element datetime or duration vector.

Output arguments

tf
Logical scalar.

Example

Covering a range

TT = timetable(seconds([1;2;4]), [1;2;3]);
containsrange(TT, timerange(seconds(1), seconds(3)))
containsrange(TT, timerange(seconds(0), seconds(3)))
Output
ans = logical
   1
ans = logical
   0

Notes

MatLivre implements only the timetable form; other kinds of input raise an error.

See also

withinrange overlapsrange timerange timetable