Commit 03b223fa authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added missing output argument to load_data routine.

New ops class member.
parent 9e8e2b99
...@@ -72,12 +72,12 @@ methods ...@@ -72,12 +72,12 @@ methods
end end
return return
elseif ischar(varargin{1}) elseif ischar(varargin{1})
[init, data, varlist, tex] = load_data(varargin{1}); [init, data, varlist, tex, ops] = load_data(varargin{1});
o.data = data; o.data = data;
o.name = varlist; o.name = varlist;
o.dates = init:init+(nobs(o)-1); o.dates = init:init+(nobs(o)-1);
o.tex = tex; o.tex = tex;
o.ops = cell(length(o.name), 1); o.ops = ops;
elseif ~isoctave() && istable(varargin{1}) elseif ~isoctave() && istable(varargin{1})
% It is assumed that the dates are in the first column. % It is assumed that the dates are in the first column.
thistable = varargin{1}; thistable = varargin{1};
...@@ -98,24 +98,24 @@ methods ...@@ -98,24 +98,24 @@ methods
% Instantiate dseries object with a data file and force the initial date to % Instantiate dseries object with a data file and force the initial date to
% be as given by the second input argument (initial period represented % be as given by the second input argument (initial period represented
% with a dates object). % with a dates object).
[init, data, varlist, tex] = load_data(varargin{1}); [init, data, varlist, tex, ops] = load_data(varargin{1});
o.data = data; o.data = data;
o.name = varlist; o.name = varlist;
o.dates = varargin{2}:varargin{2}+(nobs(o)-1); o.dates = varargin{2}:varargin{2}+(nobs(o)-1);
o.tex = tex; o.tex = tex;
o.ops = cell(length(o.name), 1); o.ops = ops;
return return
end end
if isequal(nargin,2) && ischar(varargin{1}) && ischar(varargin{2}) && isdate(varargin{2}) if isequal(nargin,2) && ischar(varargin{1}) && ischar(varargin{2}) && isdate(varargin{2})
% Instantiate dseries object with a data file and force the initial date to % Instantiate dseries object with a data file and force the initial date to
% be as given by the second input argument (initial period represented with a % be as given by the second input argument (initial period represented with a
% string). % string).
[init, data, varlist, tex] = load_data(varargin{1}); [init, data, varlist, tex, ops] = load_data(varargin{1});
o.data = data; o.data = data;
o.name = varlist; o.name = varlist;
o.dates = dates(varargin{2}):dates(varargin{2})+(nobs(o)-1); o.dates = dates(varargin{2}):dates(varargin{2})+(nobs(o)-1);
o.tex = tex; o.tex = tex;
o.ops = cell(length(o.name), 1); o.ops = ops;
return return
end end
a = varargin{1}; a = varargin{1};
......
function [init, data, varlist, tex] = load_data(filename) function [init, data, varlist, tex, ops] = load_data(filename)
% INPUTS % INPUTS
% - filename [string] Name of the file containing data. % - filename [string] Name of the file containing data.
...@@ -33,7 +33,7 @@ elseif check_file_extension(filename,'mat') ...@@ -33,7 +33,7 @@ elseif check_file_extension(filename,'mat')
elseif check_file_extension(filename,'csv') elseif check_file_extension(filename,'csv')
[freq, init, data, varlist] = load_csv_file_data(filename); [freq, init, data, varlist] = load_csv_file_data(filename);
tex = []; tex = [];
ops = []; ops = cell(length(varlist), 1);
elseif check_file_extension(filename,'xls') || check_file_extension(filename,'xlsx') elseif check_file_extension(filename,'xls') || check_file_extension(filename,'xlsx')
if isglobalinbase('options_') if isglobalinbase('options_')
% Check that the object is instantiated within a dynare session so that options_ global structure exists. % Check that the object is instantiated within a dynare session so that options_ global structure exists.
...@@ -47,13 +47,11 @@ elseif check_file_extension(filename,'xls') || check_file_extension(filename,'xl ...@@ -47,13 +47,11 @@ elseif check_file_extension(filename,'xls') || check_file_extension(filename,'xl
end end
[freq, init, data, varlist] = load_xls_file_data(filename, sheet, range); [freq, init, data, varlist] = load_xls_file_data(filename, sheet, range);
tex = []; tex = [];
ops = []; ops = cell(length(varlist), 1);
else else
error('dseries:WrongInputArguments', 'I''m not able to load data from %s!', filename); error('dseries:WrongInputArguments', 'I''m not able to load data from %s!', filename);
end end
if isempty(tex) if isempty(tex)
tex = name2tex(varlist); tex = name2tex(varlist);
else
tex = tex;
end end
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment