| Aerospace Toolbox | ![]() |
dy = decyear(v)
dy = decyear(s,f)
dy = decyear(y,mo,d)
dy = decyear([y,mo,d])
dy = decyear(y,mo,d,h,mi,s)
dy = decyear([y,mo,d,h,mi,s])
dy = decyear(v) converts one or more date vectors, v, into decimal year, dy. Input v can be an m-by-6 or m-by-3 matrix containing m full or partial date vectors, respectively. decyear returns a column vector of m decimal years.
A date vector contains six elements, specifying year, month, day, hour, minute, and second. A partial date vector has three elements, specifying year, month, and day. Each element of v must be a positive double-precision number.
dy = decyear(s,f) converts one or more date strings, s, to decimal year, dy, using format string f. s can be a character array where each row corresponds to one date string, or a one-dimensional cell array of strings. decyear returns a column vector of m decimal years, where m is the number of strings in s.
All of the date strings in s must have the same format f, which must be composed of date format symbols listed in the datestr function reference page. Formats containing the letter Q are not accepted by decyear.
Certain formats may not contain enough information to compute a date number. In those cases, hours, minutes, and seconds default to 0, days default to 1, months default to January, and years default to the current year. Date strings with two-character years are interpreted to be within the 100 years centered around the current year.
dy = decyear(y,mo,d) and dy = decyear([y,mo,d]) return the decimal year for corresponding elements of the y,mo,d (year,month,day) arrays. y, mo, and d must be arrays of the same size (or any of them can be a scalar).
dy = decyear(y,mo,d,h,mi,s) and dy = decyear([y,mo,d,h,mi,s]) return the decimal year for corresponding elements of the y,mo,d,h,mi,s (year,month,day,hour,minute,second) arrays. The six arguments must be arrays of the same size (or any of them can be a scalar).
Calculate decimal year for May 24, 2005:
dy = decyear('24-May-2005','dd-mmm-yyyy')
dy =
2.0054e+003Calculate decimal year for December 19, 2006:
dy = decyear(2006,12,19) dy = 2.0070e+003
Calculate decimal year for October 10, 2004, at 12:21:00 p.m.:
dy = decyear(2004,10,10,12,21,0) dy = 2.0048e+003
The calculation of decimal year does not take into account leap seconds.
juliandate, leapyear, mjuliandate
![]() | dcmecef2ned | delete (Aero.Animation) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |