overlapsrange

Tests whether the time span of a timetable overlaps a time range.

Category: Language Fundamentals > Data Types

Syntax

tf = overlapsrange(TT, R)

Returns true if the row times of TT overlap the range R.

Description

The result is true when some row time falls inside the range, or when the span of the timetable (earliest to latest row time) covers the whole range. Open or closed ends of a timerange are respected. The related tests containsrange and withinrange ask whether the timetable span contains the range, or lies inside it.

Input arguments

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

Output arguments

tf
Logical scalar.

Example

TT = timetable(seconds([1;2;3]), [1;2;3]);
overlapsrange(TT, timerange(seconds(2), seconds(10)))
overlapsrange(TT, timerange(seconds(5), seconds(10)))
Output
ans = logical
   1
ans = logical
   0

See also

timerange timetable withinrange containsrange isregular