%% Determine if Timetable Contains 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.1–0.35 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.1),seconds(0.35))

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

tf = containsrange(TT,rangeOfTimes)

%
% Create another time range object with a range of 0.1–0.9 seconds. For this range, the containsrange function returns 0, because 0.9 seconds is outside the time range of TT.

rangeOfTimes = timerange(seconds(0.1),seconds(0.9))
tf = containsrange(TT,rangeOfTimes)

%
% Copyright 2019 The MathWorks, Inc.