%% Specify Time Period
% Create a timetable containing prices set at the middle of each month.

Time = datetime(2018,1:12,15)';
Price = randi([85 110],12,1);
TT = timetable(Time,Price)

%
% Specify a time range using 'quarters' as the unit of time. The start of the time range is the quarter that includes January 1, 2018. The end of the range is the quarter that includes May 1, 2018. The time range includes whole quarters, meaning that the end of the range is the instant before the start of July 1, 2018.

S = timerange('2018-01-01','2018-05-01','quarters')

%
% Select rows of TT. The output timetable includes the rows for May 15 and June 15, 2018, but not the row for July 15, or any row with a time outside the first two quarters of 2018.

TT(S,:)

%
% Copyright 2018 The MathWorks, Inc.