t = datetime(2014,1,31) + calmonths(0:11)
t = 1x12 datetime array
Columns 1 through 5
31-Jan-2014 28-Feb-2014 31-Mar-2014 30-Apr-2014 31-May-2014
Columns 6 through 10
30-Jun-2014 31-Jul-2014 31-Aug-2014 30-Sep-2014 31-Oct-2014
Columns 11 through 12
30-Nov-2014 31-Dec-2014
Specify Length and Endpoints of Date or Duration Sequence
This example shows how to use the linspace function to create equally spaced datetime
or duration values between two specified endpoints.
Create a sequence of five equally spaced dates between April 14, 2014 and August 4,
- First, define the endpoints.
A = datetime(2014,04,14);
B = datetime(2014,08,04);
The third input to linspace specifies the number of linearly spaced points to generate
between the endpoints.
C = linspace(A,B,5)
C = 1x5 datetime array
14-Apr-2014 12-May-2014 09-Jun-2014 07-Jul-2014 04-Aug-2014
Create a sequence of six equally spaced durations between 1 and 5.5 hours.
A = duration(1,0,0);
B = duration(5,30,0);
C = linspace(A,B,6)
Generate Sequence of Dates and Time