See this example:
>> fecha1 = datetime([2024 2 28 21 0 15]);
>> fecha2 = datetime([2024 3 2 21 0 15]);
>> vec2 = fecha1:2:fecha2
vec2 =
28-Feb-2024 21:00:15 01-Mar-2024 21:00:15
>> incd = days(2);
>> vec2 = fecha1:incd:fecha2
vec2 =
28-Feb-2024 21:00:15 01-Mar-2024 21:00:15
When I create a sequential vector of dates using the colon operator all works apparently well as the vector stops in an element lower than the last date.
But when I use years the result is not correct:
>> fecha1 = datetime([2020 2 29 21 0 15]);
>> fecha2 = datetime([2025 1 1 0 0 0]);
>> incy = calyears(2);
>> vec1 = fecha1:incy:fecha2
vec1 =
29-Feb-2020 21:00:15 01-Mar-2022 21:00:15 01-Mar-2024 21:00:15 01-Mar-2026 21:00:15
in Matlab the result is
>> fecha1 = datetime([2020 2 29 21 0 15]);
>> fecha2 = datetime([2025 1 1 0 0 0]);
>> incy = calyears(2);
>> vec1 = fecha1:incy:fecha2
vec1 =
1×3 datetime array
29-Feb-2020 21:00:15 28-Feb-2022 21:00:15 29-Feb-2024 21:00:15
the last element is always <= the greater limit. The bug is also present using calmonths()
I don't know if this bug is related with #134
Andrew's notes
Concise repro code:
datetime([2020 2 29 21 0 15]):calyears(2):datetime([2025 1 1 0 0 0])
TODO
See this example:
When I create a sequential vector of dates using the colon operator all works apparently well as the vector stops in an element lower than the last date.
But when I use years the result is not correct:
in Matlab the result is
the last element is always <= the greater limit. The bug is also present using calmonths()
I don't know if this bug is related with #134
Andrew's notes
Concise repro code:
TODO
hi:inc:locase for negativeincvalues. Currently just returns an empty array.lo:inc:hiproduces a descending sequence of values, and vice versa forhi:inc:logiving ascending values.