Code covered by the BSD License  

Highlights from
mydate

mydate

by

 

16 Apr 2011 (Updated )

Augments MATLAB's date/time library for improved handling of epochs and formats commonly used in GPS

mydatedoyw_aux (varargin)
function [num, num0, wyear] = mydatedoyw_aux (varargin)
%MYDATEDOYW_AUX: Auxiliary function for day of water-year conversions.
    [num, year] = mydatedoy_aux (varargin{:});
    if isscalar(year),  year = year .* ones(size(num));  end
    mon = repmat(10, size(num));
    yearb = year-1;  vec0b = [yearb mon];  num0b = mydatenum(vec0b);  wyearb = yearb + 1;
    yeara = year;    vec0a = [yeara mon];  num0a = mydatenum(vec0a);  wyeara = yeara + 1;
    idx = (num < num0a);
    num0 = num0a;  num0(idx) = num0b(idx);
    wyear = wyeara;  wyear(idx) = wyearb(idx);
end

Contact us