YEARFRAC is the jCommon module of jLab.

 YEARFRAC  Converts a DATENUM into 'year.fraction' and 'month.fraction'.
   
    YF=YEARFRAC(NUM) where NUM is an array of dates in Matlab's 'datenum'
    format, returns the fraction of the year at each date.
 
    FLOOR(YF) returns the year.  Note that the actual number of days in 
    each year is used, including leap years.
 
    YF=YEARFRAC(NUM) where NUM is a cell array of numeric arrays, also
    works.  YF is then a cell array of the same size as NUM.
 
    [YF,MF]=YEARFRAC(NUM) also returns MF, the fraction of the current 
    month at each date.  FLOOR(MF) is the standard month number. 
 
    Note NaNs and Infs in NUM are passed through to the same values in YF.
   
    See also DATENUM, DATEVEC.
 
    Usage: yf=yearfrac(num);
           [yf,mf]=yearfrac(num);
    _________________________________________________________________
    This is part of JLAB --- type 'help jlab' for more information
    (C) 1998--2016 J.M. Lilly --- type 'help jlab_license' for details        

contents | allhelp | index