%% Determine if Timetable Overlaps Time Range
% Create a timetable whose row times range from 0 seconds to 0.4 seconds.

Intensity = [100;98.7;95.2;101.4;99.1];
TT = timetable(Intensity,'TimeStep',seconds(0.1))

%
% Create a time range object with a range of 0.25–1.0 seconds. To create the object, use the timerange function. Its inputs are durations, which you can create using the seconds function.

rangeOfTimes = timerange(seconds(0.25),seconds(1.0))

%
% Determine if the row times of TT overlap the range specified by rangeOfTimes.

tf = overlapsrange(TT,rangeOfTimes)

%
% Create another time range object with a range of 0.7–1.0 seconds. The overlapsrange function returns 0, because rangeOfTimes is entirely outside the time range of TT.

rangeOfTimes = timerange(seconds(0.7),seconds(1.0))
tf = overlapsrange(TT,rangeOfTimes)

% Copyright 2019 The MathWorks, Inc.