withinrange

Tests whether the row times of a timetable lie inside a time range.

Category: Language Fundamentals > Data Types

Syntax

tf = withinrange(TT, tr)

Returns true when the whole span of TT lies inside the range tr.

Description

The test compares the first and last row times of TT with the limits of tr. If both fall inside, the answer is true, otherwise false. It is one of three related checks: withinrange (the timetable is inside the range), containsrange (the range is inside the timetable) and overlapsrange (the two share some time).

The result is a single logical value for the whole timetable, not one value per row. To pick rows use a time range as a subscript instead.

Input arguments

TT
A timetable.
tr
A time range created with timerange.

Output arguments

tf
A logical scalar.

Example

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

See also

containsrange overlapsrange timerange withtol timetable