%% Determine if Timetable Is Within 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 –1 to 1 seconds. To create the object, use the timerange function. Its inputs are durations, which you can create using the seconds function.

rangeOfTimes = timerange(seconds(-1),seconds(1))

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

tf = withinrange(TT,rangeOfTimes)

%
% Create another time range object with a range of 0.1–0.9 seconds. The withinrange function returns 0 because the first row time of TT is not within rangeOfTimes.

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

% Copyright 2019 The MathWorks, Inc.