plot_shock_decomposition.m: filter out case where data to plot is empty and writing the Excel file will crash

new-samplers
Johannes Pfeifer 2023-12-07 13:50:18 +01:00
parent edaf938582
commit 54c4e9df09
1 changed files with 5 additions and 0 deletions

View File

@ -536,6 +536,11 @@ b = size(z,3);
if ~isempty(options_.plot_shock_decomp.plot_init_date)
my_initial_date = max(initial_date,options_.plot_shock_decomp.plot_init_date);
a = find((initial_date:initial_date+b-1)==options_.plot_shock_decomp.plot_init_date);
if isempty(a)
warning(['You set plot_init_date larger than the last observation. The last observation is %s,\n' ...
'while you requested as the first observation %s.Exiting because there is nothing to do.'],initial_date+b,options_.plot_shock_decomp.plot_init_date);
return;
end
end
if ~isempty(options_.plot_shock_decomp.plot_end_date)
if options_.plot_shock_decomp.plot_end_date<=(max(initial_date:initial_date+b-1))