0001 function read_data_
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 global options_ M_ oo_;
0033 dname= options_.datafile;
0034
0035 if size(oo_.endo_simul,2) < M_.maximum_lag+M_.maximum_lead+options_.periods
0036 fid = fopen([dname '_endo.dat'],'r');
0037 names_line = fgetl(fid);
0038 allVariables = '';
0039 positions = ones(0);
0040 while (any(names_line))
0041 [chopped,names_line] = strtok(names_line);
0042 if isempty(allVariables)
0043 allVariables = chopped;
0044 else
0045 allVariables = char(allVariables, chopped);
0046 end
0047 positions = [positions ; strmatch(chopped,M_.endo_names,'exact')];
0048 end
0049 Values=fscanf(fid,'%f',inf);
0050 Values=reshape(Values,M_.orig_endo_nbr,size(Values,1)/M_.orig_endo_nbr);
0051 oo_.endo_simul=[Values(positions,:); kron(oo_.steady_state((M_.orig_endo_nbr+1) : M_.endo_nbr , 1) , ones(1 , size(Values, 2)))];
0052 fclose(fid);
0053 end
0054
0055 if size(oo_.exo_simul,1) < M_.maximum_lag+M_.maximum_lead+options_.periods
0056 fid = fopen([dname '_exo.dat'],'r');
0057 names_line = fgetl(fid);
0058 allVariables = '';
0059 positions = ones(0);
0060 while (any(names_line))
0061 [chopped,names_line] = strtok(names_line);
0062 if isempty(allVariables)
0063 allVariables = chopped;
0064 else
0065 allVariables = char(allVariables, chopped);
0066 end
0067 positions = [positions ; strmatch(chopped,M_.exo_names,'exact')];
0068 end
0069 Values=fscanf(fid,'%f',inf);
0070 Values=reshape(Values,M_.exo_nbr,size(Values,1)/M_.exo_nbr);
0071 oo_.exo_simul=(Values(positions,:))';
0072 fclose(fid);
0073 end
0074
0075
0076
0077 end