Commit 8d9704f4 authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

load_xls_file_data: pass xls_range and xls_sheet as first dimension of char array

Related to Dynare/dseries#51
parent f885295c
Pipeline #6845 failed with stage
in 3 minutes and 17 seconds
......@@ -26,31 +26,31 @@ function [init, data, varlist, tex, ops, tags] = load_data(filename)
if ~nargin || ~ischar(filename) || isempty(filename)
error('dseries:load_data: Input argument cannot be an empty string!')
elseif check_file_extension(filename,'m')
elseif check_file_extension(filename(1,:),'m')
[~, init, data, varlist, tex, ops, tags] = load_m_file_data(filename);
elseif check_file_extension(filename,'mat')
elseif check_file_extension(filename(1,:),'mat')
[~, init, data, varlist, tex, ops, tags] = load_mat_file_data(filename);
elseif check_file_extension(filename,'csv')
elseif check_file_extension(filename(1,:),'csv')
[~, init, data, varlist] = load_csv_file_data(filename);
tex = [];
ops = cell(length(varlist), 1);
tags = struct();
elseif check_file_extension(filename,'xls') || check_file_extension(filename,'xlsx')
if isglobalinbase('options_')
% Check that the object is instantiated within a dynare session so that options_ global structure exists.
% Should provide latter a mechanism to pass range and sheet to dseries constructor...
range = evalin('base','options_.xls_range');
sheet = evalin('base','options_.xls_sheet');
elseif check_file_extension(filename(1,:),'xls') || check_file_extension(filename(1,:),'xlsx')
if ~isempty(deblank(filename(2,:)))
sheet = deblank(filename(2,:));
else
% By default only the (whole) first sheet is loaded.
range = [];
sheet = [];
end
[~, init, data, varlist] = load_xls_file_data(filename, sheet, range);
if ~isempty(deblank(filename(3,:)))
range = deblank(filename(3,:));
else
range = [];
end
[~, init, data, varlist] = load_xls_file_data(deblank(filename(1,:)), sheet, range);
tex = [];
ops = cell(length(varlist), 1);
tags = struct();
elseif check_file_extension(filename,'db')
elseif check_file_extension(filename(1,:),'db')
% Fame database (need to have matlab-fame-io submodule and TimeIQ installed)
FameInfo = fame.open.connector();
db = fame.open.database(FameInfo, filename);
......@@ -61,7 +61,7 @@ elseif check_file_extension(filename,'db')
ops = cell(length(varlist), 1);
tags = struct();
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(1,:));
end
if isempty(tex)
......
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