duration

Methods

Method Reference: duration.datevec

duration: DV = datevec (DT)
duration: [Y, MO, D, h, mi, s] = datevec (DT)

Convert duration array to date vectors.

DV = datevec (DT) returns an N×6 numeric matrix whose rows represent each element in DT and each column corresponds to years, months, days, hours, minutes, and seconds, respectively. Since months cannot be represented as a fixed length of time, the second column of DV is always zero. DV represents a length of time split across different fixed-length elapsed time units. The number of rows in DV equals to the number of elements in the duration array DT.

[Y, MO, D, h, mi, s] = datevec (DT) returns the components of DT as individual variables, but unlike DV in the previous syntax, each variable has the same size as the duration array DT.

Values containing a fractional portion less than 1 picosecond are rounded to the nearest picosecond.

Source Code: duration

Example: 1

datevec returns the components as a numeric row [Y MO D H MI S] per element (a duration has no year/month/day, so those columns are zero).

 d = duration (26, 30, 15)
d =
  duration

   26:30:15
 datevec (d)
ans =

    0    0    1    2   30   15