


function datatomfile (s,var_list)
This optional command saves the simulation results in a text file. The name of each
variable preceeds the corresponding results. This command must follow SIMUL.
INPUTS
s: data file name
var_list: vector of selected endogenous variables
OUTPUTS
none
SPECIAL REQUIREMENTS
none

0001 function datatomfile (s,var_list) 0002 % function datatomfile (s,var_list) 0003 % This optional command saves the simulation results in a text file. The name of each 0004 % variable preceeds the corresponding results. This command must follow SIMUL. 0005 % 0006 % INPUTS 0007 % s: data file name 0008 % var_list: vector of selected endogenous variables 0009 % 0010 % OUTPUTS 0011 % none 0012 % 0013 % SPECIAL REQUIREMENTS 0014 % none 0015 0016 % Copyright (C) 2001-2010 Dynare Team 0017 % 0018 % This file is part of Dynare. 0019 % 0020 % Dynare is free software: you can redistribute it and/or modify 0021 % it under the terms of the GNU General Public License as published by 0022 % the Free Software Foundation, either version 3 of the License, or 0023 % (at your option) any later version. 0024 % 0025 % Dynare is distributed in the hope that it will be useful, 0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0028 % GNU General Public License for more details. 0029 % 0030 % You should have received a copy of the GNU General Public License 0031 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0032 0033 global M_ oo_ 0034 0035 sm=[s,'.m']; 0036 fid=fopen(sm,'w') ; 0037 0038 if nargin < 2 || size(var_list,1) == 0 0039 var_list = M_.endo_names(1:M_.orig_endo_nbr,:); 0040 end 0041 n = size(var_list,1); 0042 ivar=zeros(n,1); 0043 for i=1:n 0044 i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact'); 0045 if isempty(i_tmp) 0046 error (['One of the specified variables does not exist']) ; 0047 else 0048 ivar(i) = i_tmp; 0049 end 0050 end 0051 0052 0053 0054 for i = 1:n 0055 fprintf(fid,[M_.endo_names(ivar(i),:), '=['],'\n') ; 0056 fprintf(fid,'\n') ; 0057 fprintf(fid,'%15.8g\n',oo_.endo_simul(ivar(i),:)') ; 0058 fprintf(fid,'\n') ; 0059 fprintf(fid,'];\n') ; 0060 fprintf(fid,'\n') ; 0061 end 0062 fclose(fid) ; 0063