%% Find Rows Within Time Range
% Create a timetable.

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

%
% Specify a time range. Then determine which rows of TT are within the time range. The second output argument, whichRows, is a logical array whose elements correspond to the rows of TT. It contains 1 for each row whose row time is within the time range, and 0 for each whose row time is not.

rangeOfTimes = timerange(seconds(0.1),seconds(0.35));
[tf,whichRows] = withinrange(TT,rangeOfTimes)

%
% To access the rows within the time range, index into TT using whichRows.

TT2 = TT(whichRows,:)

%
% Copyright 2019 The MathWorks, Inc.