%% Use Durations with Datetime Values
% Create a datetime value.

D = datetime('today')

%
% Create a datetime array in which each value has the same date but different time components. One convenient way to create such an array is to add a duration array to D.
% First, create an array of hours using the hours function. Each element is two hours longer than the previous element.

H = hours(0:2:6)

%
% Then, add D and H.

T = D + H

%
% Use duration arrays for arithmetic operations with datetime arrays and fixed lengths of time.
% Copyright 2012 The MathWorks, Inc.