2005-02-18 20:54:39 +01:00
|
|
|
function dynatype (s,var_list)
|
2008-01-29 14:38:04 +01:00
|
|
|
% function dynatype (s,var_list)
|
2020-01-06 12:01:41 +01:00
|
|
|
% This command saves the simulation results in a text file. The name of each
|
2008-01-29 14:38:04 +01:00
|
|
|
% variable preceeds the corresponding results. This command must follow SIMUL.
|
2017-05-16 15:10:20 +02:00
|
|
|
%
|
2008-01-29 14:38:04 +01:00
|
|
|
% INPUTS
|
2008-10-13 18:06:07 +02:00
|
|
|
% s: filename
|
2008-01-29 14:38:04 +01:00
|
|
|
% var_list: vector of selected endogenous variables
|
2017-05-16 15:10:20 +02:00
|
|
|
%
|
2008-01-29 14:38:04 +01:00
|
|
|
% OUTPUTS
|
|
|
|
% none
|
|
|
|
%
|
|
|
|
% SPECIAL REQUIREMENTS
|
|
|
|
% none
|
|
|
|
|
2022-04-13 13:15:19 +02:00
|
|
|
% Copyright © 2001-2020 Dynare Team
|
2008-08-01 14:40:33 +02:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2005-02-18 20:54:39 +01:00
|
|
|
|
|
|
|
global M_ oo_
|
|
|
|
|
2020-01-06 12:01:41 +01:00
|
|
|
fid = fopen(s, 'w');
|
2005-02-18 20:54:39 +01:00
|
|
|
|
2017-10-10 10:05:59 +02:00
|
|
|
if isempty(var_list)
|
|
|
|
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
Fixes for ticket #57
preprocessor:
* add a field "M_.orig_endo_nbr" containing the nbr of endogenous before adding aux vars
* always provide "M_.aux_vars" (define it to "[]" when there is no aux var)
* rename "M_.aux_vars().orig_endo_index" to "M_.aux_vars().orig_index"
M-files:
* for commands which accept a list of variables (stoch_simul, osr, estimation, dynasave, dynatype, datatomfile), when no variable is given, use only the set of original endogenous (without aux vars) as the default
* when displaying the decision rule, when there is aux vars in the state variables, replace them by their original name (with the right lag)
* in "steady", don't display aux vars
* special exception for ramsey policy: all vars (including aux vars) are displayed, because the system of aux vars from ramsey policy is not compatible with the aux vars from the preprocessor
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3166 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-11-25 11:22:39 +01:00
|
|
|
end
|
|
|
|
|
2020-01-06 12:01:41 +01:00
|
|
|
for i = 1:length(var_list)
|
|
|
|
idx = strcmp(var_list{i}, M_.endo_names);
|
|
|
|
if any(idx)
|
|
|
|
fprintf(fid, '%s\n', M_.endo_names{idx});
|
|
|
|
fprintf(fid, '%15.8g\n', oo_.endo_simul(idx,:)');
|
2005-02-18 20:54:39 +01:00
|
|
|
else
|
2020-01-06 12:01:41 +01:00
|
|
|
idx = strcmp(var_list{i}, M_.exo_names);
|
|
|
|
if any(idx)
|
|
|
|
fprintf(fid, '%s\n', M_.exo_names{idx});
|
|
|
|
fprintf(fid, '%15.8g\n', oo_.exo_simul(:,idx));
|
|
|
|
else
|
|
|
|
error(['Should not arrive here: ' var_list{i} ' not found in M_.endo_names or M_.exo_names']) ;
|
|
|
|
end
|
2005-02-18 20:54:39 +01:00
|
|
|
end
|
2009-12-16 18:17:34 +01:00
|
|
|
end
|
2005-02-18 20:54:39 +01:00
|
|
|
|
2020-01-06 12:01:41 +01:00
|
|
|
fclose(fid);
|
2005-02-18 20:54:39 +01:00
|
|
|
end
|