Takes a date vector and returns the day of year, known incorrectly in the Geophysical community as the Julian calender day, i.e. 12/31/2005 is returned as day 365, day 06/22/2010 is returned as 173, etc... The function is vectorized. This function needs etime.m (R2009a and later).
USAGES
julday = datevec2doy(mydate)
INPUT
mydate: Either a 6xN or Nx6 array of date vectors, as output by
functions like datevec.
OUTPUT
julday: An Nx1 array of julian days.
-----------------------------------------------------------------------
EXAMPLE
%Take the current day and add normally distributed random days to the
%date.
tadd = randn(1,12);
mydate = datevec(now)';
mydate = repmat(mydate,1,12);
mydate(2,:) = mydate(2,:) + tadd;
day = datevec2doy(mydate);
|