From 6f7265337b13b9b4d0395acc22a3d6234ff50947 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Tue, 12 May 2015 08:00:16 +0200 Subject: [PATCH] Fix saving of graphs in forecast_graphs.m Did not use the M_.dname folder, but rather fname --- matlab/forecast_graphs.m | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/matlab/forecast_graphs.m b/matlab/forecast_graphs.m index d4bbc5094..d068169b1 100644 --- a/matlab/forecast_graphs.m +++ b/matlab/forecast_graphs.m @@ -8,7 +8,7 @@ function forecast_graphs(var_list,M_, oo_,options_) % o oo_ outputs structure % o options_ options structure -% Copyright (C) 2008-2013 Dynare Team +% Copyright (C) 2008-2015 Dynare Team % % This file is part of Dynare. % @@ -30,6 +30,7 @@ nr = 3; exo_nbr = M_.exo_nbr; endo_names = M_.endo_names; fname = M_.fname; +dname = M_.dname; yf = oo_.forecast.Mean; hpdinf = oo_.forecast.HPDinf; hpdsup = oo_.forecast.HPDsup; @@ -40,18 +41,18 @@ i_var = []; for i = 1:size(var_list) tmp = strmatch(var_list(i,:),endo_names,'exact'); if isempty(tmp) - error([var_list(i,:) ' isn''t and endogenous variable']) + error([var_list(i,:) ' isn''t an endogenous variable']) end i_var = [i_var; tmp]; end nvar = length(i_var); -% create subdirectory /graphs if id doesn't exist -if ~exist(fname, 'dir') - mkdir('.',fname); +% create subdirectory /graphs if id doesn't exist +if ~exist(dname, 'dir') + mkdir('.',dname); end -if ~exist([fname '/graphs']) - mkdir(fname,'graphs'); +if ~exist([dname '/graphs'],'dir') + mkdir(dname,'graphs'); end m = 1; @@ -59,7 +60,7 @@ n_fig = 1; hh=dyn_figure(options_,'Name','Forecasts (I)'); for j= 1:nvar if m > nc*nr; - dyn_saveas(hh,[ fname '/graphs/forcst' int2str(n_fig)],options_); + dyn_saveas(hh,[ dname '/graphs/forcst' int2str(n_fig)],options_); n_fig =n_fig+1; eval(['hh=dyn_figure(options_,''Name'',''Forecasts (' int2str(n_fig) ')'');']); @@ -87,5 +88,5 @@ for j= 1:nvar end if m > 1 - dyn_saveas(hh,[fname '/graphs/forcst' int2str(n_fig)],options_); + dyn_saveas(hh,[dname '/graphs/forcst' int2str(n_fig)],options_); end \ No newline at end of file