Functions | |
if (nargin==0||(nargin > 2 &&ischar(Y))||nargin > 6) print_usage() | |
endif | if (ischar(Y)) if(nargin< 2) M |
else | if (nargin< 6) s=0 |
endif | if (nargin==1) nc |
if (nc > 6||nc< 3) error("expected date vector containing [Y | |
if (nc >=6) s | |
endif endif | M (M< 1) |
if (numel(M)==1||numel(D)==1) D+ | |
if (numel(M) > 1) D | |
!assert (datenum(2001, 5, 19), 730990)%!assert(datenum([1417 | |
!assert (datenum([2001, 5, 19;1417, 6, 12]),[730990;517712])%!assert(datenum(2001 | |
!assert (datenum(t), n, 2 *eps) | |
!assert (datenum(t(1,:), t(2,:), t(3,:), t(4,:), t(5,:), t(6,:)), n, 2 *eps) | |
!assert (datenum([2008;2009], 1, 1),[datenum(2008, 1, 1);datenum(2009, 1, 1)]) | |
!assert (datenum(2008,[1;2], 1),[datenum(2008, 1, 1);datenum(2008, 2, 1)]) | |
!assert (datenum(2008, 1,[1;2]),[datenum(2008, 1, 1);datenum(2008, 1, 2)]) | |
!assert (datenum([2008;2009],[1;2], 1),[datenum(2008, 1, 1);datenum(2009, 2, 1)]) | |
!assert (datenum([2008;2009], 1,[1;2]),[datenum(2008, 1, 1);datenum(2009, 1, 2)]) | |
!assert (datenum(2008,[1;2],[1;2]),[datenum(2008, 1, 1);datenum(2008, 2, 2)]) | |
!assert (datenum([2008 2009], 1, 1),[datenum(2008, 1, 1) datenum(2009, 1, 1)]) | |
!assert (datenum(2008,[1 2], 1),[datenum(2008, 1, 1) datenum(2008, 2, 1)]) | |
!assert (datenum(2008, 1,[1 2]),[datenum(2008, 1, 1) datenum(2008, 1, 2)]) | |
!assert (datenum([2008 2009],[1 2], 1),[datenum(2008, 1, 1) datenum(2009, 2, 1)]) | |
!assert (datenum([2008 2009], 1,[1 2]),[datenum(2008, 1, 1) datenum(2009, 1, 2)]) | |
!assert (datenum(2008,[1 2],[1 2]),[datenum(2008, 1, 1) datenum(2008, 2, 2)]) | |
Variables | |
function [days, secs] | |
endif [Y, M, D, h, m, s] = datevec (Y, M) | |
M = Y(:,2) | |
D = Y(:,3) | |
h | |
m | |
s = m = h = 0 | |
Y = Y(:,1) | |
days = D + (h+(m+s/60)/60)/24 | |
secs = 86400*D + h*3600 + m*60 + s | |
endfunction!shared part | !part = 0.514623842592593 |
!n = [730990 | |
!test | !t = [2001,5,19,12,21,3.5 |
!assert | ( | datenum(2008,[1 2],[1 2]) | ) |
!assert | ( | datenum([2008 2009], 1,[1 2]) | ) |
!assert | ( | datenum([2008 2009],[1 2], 1) | ) |
!assert | ( | datenum(2008, 1,[1 2]) | ) |
!assert | ( | datenum(2008,[1 2], 1) | ) |
!assert | ( | datenum([2008 2009], 1, 1) | ) |
!assert | ( | datenum(2008,[1;2],[1;2]) | ) |
!assert | ( | datenum([2008;2009], 1,[1;2]) | ) |
!assert | ( | datenum([2008;2009],[1;2], 1) | ) |
!assert | ( | datenum(2008, 1,[1;2]) | ) |
!assert | ( | datenum(2008,[1;2], 1) | ) |
!assert | ( | datenum([2008;2009], 1, 1) | ) |
!assert | ( | datenum(t(1,:), t(2,:), t(3,:), t(4,:), t(5,:), t(6,:)) | , | |
n | , | |||
2 * | eps | |||
) |
!assert | ( | datenum(t) | , | |
n | , | |||
2 * | eps | |||
) |
!assert | ( | datenum([2001, 5, 19;1417, 6, 12]) | ) |
!assert | ( | datenum(2001, 5, 19) | , | |
730990 | ||||
) |
if | ( | numel(M) | , | |
1 | ||||
) |
if | ( | numel(M) | = =1||numel(D)==1 |
) |
if | ( | nc >= | 6 | ) |
if | ( | nc | ) |
else if | ( | ) | [pure virtual] |
endif if | ( | ischar(Y) | ) |
!n = [730990 |
endfunction !shared part !part = 0.514623842592593 |
!test !t = [2001,5,19,12,21,3.5 |
h |
m |
M = Y(:,2) |
endif s = m = h = 0 |
Y = Y(:,1) |