calendarDuration.datevec
calendarDuration: DV = datevec (calD)
calendarDuration: [Y, MO] = datevec (calD)
calendarDuration: [Y, MO, D] = datevec (calD)
calendarDuration: [Y, MO, D, H] = datevec (calD)
calendarDuration: [Y, MO, D, H, MI] = datevec (calD)
calendarDuration: [Y, MO, D, H, MI, S] = datevec (calD)
Convert calendarDuration array to date vectors.
DV = datevec (calD) returns an numeric
matrix, where is the number of elements in calD and the
columns corresponds to years, months, days, hours, minutes, and seconds,
respectively.
When datevec is called with more than one output arguments, then
it returns the components of the date vectors as individual variables
Y, MO, D, H, MI,and S corresponding
to years, months, days, hours, minutes, and seconds, respectively. In
this case, the individual variables have the same size as the input array
calD.
Source Code: calendarDuration
datevec returns the span as a numeric row [Y MO D H MI S] per element, handy for feeding the raw components into other calculations.
d = calendarDuration (1, 2, 3, 4, 5, 6)
d = calendarDuration 1y 2mo 3d 4h 5m 6s
datevec (d)
ans = 1 2 3 4 5 6