Changed dates constructor so that an object can be instantiated by passing the freq and time member or the freq member, the first column of the time member and the second column of the time member (mandatory only for non annual frequency).
parent
f28bc166f6
commit
2f7e9959f0
|
@ -89,14 +89,19 @@ switch nargin
|
||||||
error('dates:: Wrong calling sequence of the constructor!')
|
error('dates:: Wrong calling sequence of the constructor!')
|
||||||
end
|
end
|
||||||
otherwise
|
otherwise
|
||||||
dd.ndat = nargin;
|
|
||||||
dd.time = NaN(dd.ndat,2);
|
|
||||||
if isdate(varargin{1})
|
if isdate(varargin{1})
|
||||||
|
dd.ndat = nargin;
|
||||||
|
dd.time = NaN(dd.ndat,2);
|
||||||
date = string2date(varargin{1});
|
date = string2date(varargin{1});
|
||||||
dd.freq = date.freq;
|
dd.freq = date.freq;
|
||||||
dd.time(1,:) = date.time;
|
dd.time(1,:) = date.time;
|
||||||
|
elseif isfreq(varargin{1})
|
||||||
|
S.type = '()';
|
||||||
|
S.subs = varargin;
|
||||||
|
dd = subsref(dd,S);
|
||||||
|
return
|
||||||
else
|
else
|
||||||
error(['dates::dates: Input 1 has to be a string date!'])
|
error(['dates::dates: Wrong calling sequence!'])
|
||||||
end
|
end
|
||||||
for i=2:dd.ndat
|
for i=2:dd.ndat
|
||||||
if isdate(varargin{i})
|
if isdate(varargin{i})
|
||||||
|
|
Loading…
Reference in New Issue