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

mydatebase (is_diff)
function [factor, Num, dNum, dyear] = mydatebase (is_diff)
%MYDATEBASE: Define base information for internal use in mydate functions.
    if (nargin < 1) || isempty(is_diff),  is_diff = false;  end
    factor = 60 * 60 * 24;  % datenum is in decimal days, mydatenum is in seconds.
    if is_diff
        dyear = 0;
        dvec = zeros(1,6);
    else
        dyear = 2000;
        dvec = [0 1 1  0 0 0];
    end
    dNum = datenum(dvec);
    vec = dvec;  vec(1) = dyear;
    Num = datenum(vec);
end

%!test
%! [vec, num, factor] = mydatebase ();
%! assert(isequal(size(vec), [1,6]))
%! assert(isscalar(num))
%! assert(isscalar(factor))

Contact us