Commit 25011b78 authored by michel's avatar michel
Browse files

adjusting header and re-indenting file


git-svn-id: https://www.dynare.org/svn/dynare/trunk@2390 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 8ff680b0
......@@ -17,7 +17,7 @@ function dyn_data_01=read_variables(file_name_01,var_names_01,dyn_data_01,xls_sh
% all local variables have complicated names in order to avoid name
% conflicts with possible user variable names
% Copyright (C) 2005-2007 Dynare Team
% Copyright (C) 2005-2009 Dynare Team
%
% This file is part of Dynare.
%
......@@ -42,47 +42,47 @@ function dyn_data_01=read_variables(file_name_01,var_names_01,dyn_data_01,xls_sh
cd(path_name_02)
end
dyn_size_01 = size(dyn_data_01,1);
var_size_01 = size(var_names_01,1);
if exist(file_name_01)
file_name_02 = [file_name_01 '.m'];
dyn_instr_01 = file_name_01;
eval(dyn_instr_01);
for dyn_i_01=1:var_size_01
dyn_tmp_01 = eval(var_names_01(dyn_i_01,:));
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
dyn_size_01 = size(dyn_data_01,1);
var_size_01 = size(var_names_01,1);
if exist(file_name_01)
file_name_02 = [file_name_01 '.m'];
dyn_instr_01 = file_name_01;
eval(dyn_instr_01);
for dyn_i_01=1:var_size_01
dyn_tmp_01 = eval(var_names_01(dyn_i_01,:));
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
elseif exist([file_name_01 '.mat'])
file_name_02 = [file_name_01 '.mat']
s = load(file_name_01);
for dyn_i_01=1:var_size_01
dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
elseif exist([file_name_01 '.xls'])
file_name_02 = [file_name_01 '.xls'];
[num,txt,raw] = xlsread(file_name_01,xls_sheet,xls_range);
for dyn_i_01=1:var_size_01
iv = strmatch(var_names_01(dyn_i_01,:),raw(1,:),'exact');
dyn_tmp_01 = [raw{2:end,iv}]';
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
else
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
error(['Can''t find datafile: ' file_name_01 ]);
end
elseif exist([file_name_01 '.mat'])
file_name_02 = [file_name_01 '.mat']
s = load(file_name_01);
for dyn_i_01=1:var_size_01
dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
elseif exist([file_name_01 '.xls'])
file_name_02 = [file_name_01 '.xls'];
[num,txt,raw] = xlsread(file_name_01,xls_sheet,xls_range);
for dyn_i_01=1:var_size_01
iv = strmatch(var_names_01(dyn_i_01,:),raw(1,:),'exact');
dyn_tmp_01 = [raw{2:end,iv}]';
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
end
else
cd(old_pwd)
error(['Can''t find datafile: ' file_name_01 ]);
end
cd(old_pwd)
disp(sprintf('Loading %d observations from %s\n',...
size(dyn_data_01,1),file_name_02))
cd(old_pwd)
disp(sprintf('Loading %d observations from %s\n',...
size(dyn_data_01,1),file_name_02))
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