Code factorization.
parent
c93f972ee5
commit
e75df484e9
|
@ -124,13 +124,18 @@ switch nargin
|
||||||
ts.vobs = length(varlist);
|
ts.vobs = length(varlist);
|
||||||
ts.nobs = size(data,1);
|
ts.nobs = size(data,1);
|
||||||
if isempty(tex)
|
if isempty(tex)
|
||||||
ts.tex = cell(ts.vobs,1);
|
ts.tex = name2tex(varlist);
|
||||||
for i=1:ts.vobs
|
|
||||||
ts.tex(i) = {name2tex(varlist{i})};
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
ts.tex = tex;
|
ts.tex = tex;
|
||||||
end
|
end
|
||||||
|
elseif isnumeric(varargin{1}) && isequal(ndims(varargin{1}),2)
|
||||||
|
ts.data = varargin{1};
|
||||||
|
[ts.nobs, ts.vobs] = size(ts.data);
|
||||||
|
ts.freq = 1;
|
||||||
|
ts.init = dynDate(1);
|
||||||
|
ts.time = ts.init:ts.init+ts.nobs;
|
||||||
|
ts.name = default_name(ts.vobs);
|
||||||
|
ts.tex = name2tex(ts.name);
|
||||||
end
|
end
|
||||||
case {2,3,4}
|
case {2,3,4}
|
||||||
a = varargin{1};
|
a = varargin{1};
|
||||||
|
@ -177,9 +182,7 @@ switch nargin
|
||||||
error('dynSeries::dynSeries: The number of declared names does not match the number of variables!')
|
error('dynSeries::dynSeries: The number of declared names does not match the number of variables!')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i=1:ts.vobs
|
ts.name = default_name(ts.vobs);
|
||||||
ts.name = vertcat(ts.name, {['Variable_' int2str(i)]});
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if ~isempty(d)
|
if ~isempty(d)
|
||||||
if ts.vobs==length(d)
|
if ts.vobs==length(d)
|
||||||
|
@ -190,9 +193,7 @@ switch nargin
|
||||||
error('dynSeries::dynSeries: The number of declared tex names does not match the number of variables!')
|
error('dynSeries::dynSeries: The number of declared tex names does not match the number of variables!')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i=1:ts.vobs
|
ts.tex = name2tex(ts.name);
|
||||||
ts.tex = vertcat(ts.tex, {name2tex(ts.name{i})});
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
otherwise
|
otherwise
|
||||||
error('dynSeries::dynSeries: Can''t instantiate the class, wrong calling sequence!')
|
error('dynSeries::dynSeries: Can''t instantiate the class, wrong calling sequence!')
|
||||||
|
|
Loading…
Reference in New Issue