v4 tests/practicing: modified datasaver.m for version 4

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1472 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
michel 2007-12-04 16:06:16 +00:00
parent 187f543a05
commit 16e05b418b
1 changed files with 24 additions and 10 deletions

View File

@ -1,15 +1,29 @@
% Copyright (C) 2001 Michel Juillard
%
function dynatype (s,var_list)
% DYNATYPE : DYNATYPE ( [ 'filename' ] )
% 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.
function datasaver (s,var_list)
% datasaver saves variables simulated by Dynare
% INPUT
% s: a string containing the name of the destination *.m file
% var_list: a character matrix containting the name of the variables
% to be saved (optional, default: all endogenous variables)
% OUTPUT
% none
% This is part of the examples included in F. Barillas, R. Colacito,
% S. Kitao, C. Matthes, T. Sargent and Y. Shin (2007) "Practicing
% Dynare".
% Modified by M. Juillard to make it also compatible with Dynare
% version 4 (12/4/07)
global lgy_ lgx_ y_ endo_nbr
global lgy_ lgx_ y_ endo_nbr M_ oo_
% test and adapt for Dynare version 4
if isempty(lgy_)
lgy_ = M_.endo_names;
lgx_ + M_.exo_names;
y_ = oo_.endo_simul;
endo_nbr = M_.endo_nbr;
end
%fid=fopen([s,'.m'],'w') ;
sm=[s,'.m'];
fid=fopen(sm,'w') ;