From 16e05b418b2279935d4d51e061833ff8cc66b186 Mon Sep 17 00:00:00 2001 From: michel Date: Tue, 4 Dec 2007 16:06:16 +0000 Subject: [PATCH] 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 --- tests/practicing/datasaver.m | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/tests/practicing/datasaver.m b/tests/practicing/datasaver.m index dcee78ca4..2c72e20e1 100644 --- a/tests/practicing/datasaver.m +++ b/tests/practicing/datasaver.m @@ -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') ;