Rng = datrange(Start,End)
Rng = datrange(Start,End,Step)
Start [ numeric ] - Start date of the range.
End [ numeric ] - End date of the range.
Step [ numeric ] - Step size in the number of base periods; if omitted, Step = 1.
Rng [ numeric ] - Date vector Start : Step : End.Most of the time, using a colon operator to create a date range works fine,
Start : Step : End
Under some (rather rare) circumstances, the colon operator may give incorrect results caused by rounding error difficulties since IRIS serial date numbers are non-integer values. In that case, the function datrange provides a safe workaround:
datrange(Start,End,Step)
is equivalent (but numerically safer) to
Start : Step : End
The date ranges created in this example are identical, and no numerical inaccuracies exist:
r1 = qq(2000,1) : qq(2010,4);
r2 = datrange(qq(2000,1),qq(2010,4));
format long
r1 - r2