


function save_params_and_steady_state(filename) For all parameters, endogenous and exogenous variables, stores their value in a text file. * for parameters, the value is taken from the last parameter initialization * for exogenous, the value is taken from the last initval block * for endogenous, the value is taken from the last steady state computation (or, if no steady state has been computed, from the last initval block) Note that no variable type is stored in the file, so that the values can be reloaded (with load_params_and_steady_state) in a setup where the variable types are different. INPUTS filename: where to store the saved values OUTPUTS none SPECIAL REQUIREMENTS none


0001 function save_params_and_steady_state(filename) 0002 % function save_params_and_steady_state(filename) 0003 % 0004 % For all parameters, endogenous and exogenous variables, stores 0005 % their value in a text file. 0006 % * for parameters, the value is taken from the last parameter 0007 % initialization 0008 % * for exogenous, the value is taken from the last initval block 0009 % * for endogenous, the value is taken from the last steady state 0010 % computation (or, if no steady state has been computed, from the 0011 % last initval block) 0012 % Note that no variable type is stored in the file, so that the values 0013 % can be reloaded (with load_params_and_steady_state) in a setup where 0014 % the variable types are different. 0015 % 0016 % INPUTS 0017 % filename: where to store the saved values 0018 % 0019 % OUTPUTS 0020 % none 0021 % 0022 % SPECIAL REQUIREMENTS 0023 % none 0024 0025 % Copyright (C) 2008-2009 Dynare Team 0026 % 0027 % This file is part of Dynare. 0028 % 0029 % Dynare is free software: you can redistribute it and/or modify 0030 % it under the terms of the GNU General Public License as published by 0031 % the Free Software Foundation, either version 3 of the License, or 0032 % (at your option) any later version. 0033 % 0034 % Dynare is distributed in the hope that it will be useful, 0035 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0036 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0037 % GNU General Public License for more details. 0038 % 0039 % You should have received a copy of the GNU General Public License 0040 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0041 0042 global M_ oo_ 0043 0044 fid = fopen(filename, 'w'); 0045 if fid < 0 0046 error([ 'SAVE_PARAMS_AND_STEADY_STATE: Can''t open ' filename ]); 0047 end 0048 0049 for i = 1:M_.param_nbr 0050 fprintf(fid, '%s %.16g\n', M_.param_names(i,:), M_.params(i)); 0051 end 0052 0053 for i = 1:M_.endo_nbr 0054 fprintf(fid, '%s %.16g\n', M_.endo_names(i,:), oo_.steady_state(i)); 0055 end 0056 0057 for i = 1:M_.exo_nbr 0058 fprintf(fid, '%s %.16g\n', M_.exo_names(i,:), oo_.exo_steady_state(i)); 0059 end 0060 0061 for i = 1:M_.exo_det_nbr 0062 fprintf(fid, '%s %.16g\n', M_.exo_det_names(i,:), oo_.exo_det_steady_state(i)); 0063 end 0064 0065 fclose(fid);