From 649f668dd1dbc37feb1d28d2130e53d7a6e41bd8 Mon Sep 17 00:00:00 2001
From: Willi Mutschler <willi@mutschler.eu>
Date: Tue, 19 Sep 2023 13:19:07 +0200
Subject: [PATCH] cosmetical: don't use hh for figure/plot/table handles

We use it to denote the hessian and even store it in many mat files.
---
 doc/parallel/parallel.tex                     |  2 +-
 examples/Gali_2015.mod                        | 10 ++---
 matlab/+occbin/DSGE_smoother.m                |  6 +--
 matlab/+occbin/IVF_core.m                     | 14 +++----
 matlab/+occbin/graph.m                        |  6 +--
 matlab/+occbin/solve_one_constraint.m         | 14 +++----
 matlab/+occbin/solve_two_constraints.m        | 14 +++----
 matlab/DSMH_sampler.m                         |  6 +--
 matlab/Herbst_Schorfheide_sampler.m           |  6 +--
 matlab/MakeAllFigures.m                       | 24 +++++------
 matlab/PlotPosteriorDistributions.m           |  4 +-
 matlab/PosteriorIRF_core2.m                   | 10 ++---
 matlab/UnivariateSpectralDensity.m            |  6 +--
 matlab/calibrate_mh_scale_parameter.m         | 10 ++---
 matlab/dynare_estimation.m                    |  6 +--
 matlab/dyntable.m                             |  8 ++--
 matlab/ep/extended_path.m                     | 10 ++---
 matlab/forecast_graphs.m                      | 18 ++++-----
 matlab/gsa/filt_mc_.m                         | 40 +++++++++----------
 matlab/gsa/map_ident_.m                       | 30 +++++++-------
 matlab/gsa/pick.m                             |  8 ++--
 matlab/gsa/redform_map.m                      | 40 +++++++++----------
 matlab/gsa/redform_screen.m                   | 18 ++++-----
 matlab/gsa/scatter_mcf.m                      |  6 +--
 matlab/gsa/scatter_plots.m                    |  8 ++--
 matlab/gsa/stab_map_1.m                       |  8 ++--
 matlab/gsa/stab_map_2.m                       |  8 ++--
 matlab/mh_autocorrelation_function.m          |  4 +-
 matlab/missing_DiffuseKalmanSmootherH3_Z.m    | 10 ++---
 .../online_auxiliary_filter.m                 | 10 ++---
 matlab/olsgibbs.m                             | 10 ++---
 matlab/optimization/gmhmaxlik_core.m          | 34 ++++++++--------
 matlab/plot_icforecast.m                      |  6 +--
 matlab/plot_identification.m                  | 22 +++++-----
 matlab/pm3_core.m                             | 10 ++---
 matlab/posterior_sampler_core.m               | 12 +++---
 matlab/prior_sampler.m                        |  8 ++--
 matlab/rplot.m                                | 14 +++----
 matlab/stoch_simul.m                          | 16 ++++----
 matlab/surgibbs.m                             | 10 ++---
 matlab/trace_plot.m                           |  6 +--
 .../system_prior_restriction/Gali_2015.mod    |  8 ++--
 42 files changed, 260 insertions(+), 260 deletions(-)

diff --git a/doc/parallel/parallel.tex b/doc/parallel/parallel.tex
index 9dd23b1ae8..7fdd48db3a 100644
--- a/doc/parallel/parallel.tex
+++ b/doc/parallel/parallel.tex
@@ -907,7 +907,7 @@ waitbarString = [ '(' int2str(b) '/' int2str(mh_nblck) ') ...
 
     if mod(j, 3)==0 & ~whoiam
         % serial computation
-        waitbar(prtfrc,hh,waitbarString);
+        waitbar(prtfrc,hh_fig,waitbarString);
 
     elseif mod(j,50)==0 & whoiam,
         % parallel computation
diff --git a/examples/Gali_2015.mod b/examples/Gali_2015.mod
index 834b211e5c..dd43158cc1 100644
--- a/examples/Gali_2015.mod
+++ b/examples/Gali_2015.mod
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright © 2021 Dynare Team
+ * Copyright © 2021-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -147,13 +147,13 @@ end;
 varobs yhat;
 
 % Run prior function to get prior slope of the PC based on independent priors
-hh=figure('Name','Slope of the Phillips Curve');
+hh_fig=figure('Name','Slope of the Phillips Curve');
 prior_function(function='Gali_2015_PC_slope');
 PC_slope_vec=cell2mat(oo_.prior_function_results(:,1));
 
 optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
 [density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
-figure(hh)
+figure(hh_fig)
 subplot(3,1,1)
 plot(density(:,1),density(:,2));
 title('Prior')
@@ -165,7 +165,7 @@ posterior_function(function='Gali_2015_PC_slope');
 PC_slope_vec=cell2mat(oo_.posterior_function_results(:,1));
 optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
 [density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
-figure(hh)
+figure(hh_fig)
 subplot(3,1,2)
 plot(density(:,1),density(:,2));
 title('Updated Prior')
@@ -178,7 +178,7 @@ posterior_function(function='Gali_2015_PC_slope');
 PC_slope_vec=cell2mat(oo_.posterior_function_results(:,1));
 optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
 [density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
-figure(hh)
+figure(hh_fig)
 subplot(3,1,3)
 plot(density(:,1),density(:,2));
 title('Posterior')
diff --git a/matlab/+occbin/DSGE_smoother.m b/matlab/+occbin/DSGE_smoother.m
index 656e84a3ce..79319b3868 100644
--- a/matlab/+occbin/DSGE_smoother.m
+++ b/matlab/+occbin/DSGE_smoother.m
@@ -42,7 +42,7 @@ function [alphahat,etahat,epsilonhat,ahat0,SteadyState,trend_coeff,aKK,T0,R0,P,P
 % - alphahat0     [double]  (m*1) array, smoothed endogenous variables in period 0 (a_{0|T})  (decision-rule order)
 % - state_uncertainty0 [double] (K,K,1) array, storing the uncertainty in period 0
 
-% Copyright © 2021 Dynare Team
+% Copyright © 2021-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -401,7 +401,7 @@ if (~is_changed || occbin_smoother_debug) && nargin==12
             if M_.Sigma_e(j,j)
                 j1=j1+1;
                 if mod(j1,9)==1
-                    hfig = dyn_figure(options_.nodisplay,'name','Occbin smoothed shocks');
+                    hh_fig = dyn_figure(options_.nodisplay,'name','Occbin smoothed shocks');
                     ifig=ifig+1;
                     isub=0;
                 end
@@ -427,7 +427,7 @@ if (~is_changed || occbin_smoother_debug) && nargin==12
             if mod(j1,9)~=0 && j==M_.exo_nbr
                 annotation('textbox', [0.1,0,0.35,0.05],'String', 'Linear','Color','Blue','horizontalalignment','center','interpreter','none');
                 annotation('textbox', [0.55,0,0.35,0.05],'String', 'Piecewise','Color','Red','horizontalalignment','center','interpreter','none');
-                dyn_saveas(hfig,[GraphDirectoryName filesep M_.fname,'_smoothedshocks_occbin',int2str(ifig)],options_.nodisplay,options_.graph_format);
+                dyn_saveas(hh_fig,[GraphDirectoryName filesep M_.fname,'_smoothedshocks_occbin',int2str(ifig)],options_.nodisplay,options_.graph_format);
             end
         end
     end
diff --git a/matlab/+occbin/IVF_core.m b/matlab/+occbin/IVF_core.m
index ad943bafbe..82cacf2a1d 100644
--- a/matlab/+occbin/IVF_core.m
+++ b/matlab/+occbin/IVF_core.m
@@ -65,13 +65,13 @@ opts_simul.piecewise_only = 1;
 filtered_errs=zeros(sample_length,n_obs);
 
 if options_.occbin.likelihood.waitbar
-    hh = dyn_waitbar(0,'IVF_core: Filtering the shocks');
-    set(hh,'Name','IVF_core: Filtering the shocks.');
+    hh_fig = dyn_waitbar(0,'IVF_core: Filtering the shocks');
+    set(hh_fig,'Name','IVF_core: Filtering the shocks.');
 end
 
 for this_period=1:sample_length
     if options_.occbin.likelihood.waitbar
-        dyn_waitbar(this_period/sample_length, hh, sprintf('Period %u of %u', this_period,sample_length));
+        dyn_waitbar(this_period/sample_length, hh_fig, sprintf('Period %u of %u', this_period,sample_length));
     end
     current_obs = obs(this_period,:);
     init_val_old = init_val;
@@ -89,7 +89,7 @@ for this_period=1:sample_length
         filtered_errs=NaN;
         error_code(1) = 304;
         error_code(4) = 1000;
-        if options_.occbin.likelihood.waitbar; dyn_waitbar_close(hh); end
+        if options_.occbin.likelihood.waitbar; dyn_waitbar_close(hh_fig); end
         return
     end
     filtered_errs(this_period,inan)=err_vals_out';
@@ -103,7 +103,7 @@ for this_period=1:sample_length
         error_code(1) = 306;
         error_code(4) = max(abs(err_vals_out))/1000;
         filtered_errs=NaN;
-        if options_.occbin.likelihood.waitbar; dyn_waitbar_close(hh); end
+        if options_.occbin.likelihood.waitbar; dyn_waitbar_close(hh_fig); end
         return
     end
     if max(abs(resids(this_period,:)))>0.001
@@ -112,12 +112,12 @@ for this_period=1:sample_length
         filtered_errs=NaN;
         error_code(1) = 303;
         error_code(4) = max(abs(resids(this_period,:)))*100;
-        if options_.occbin.likelihood.waitbar; dyn_waitbar_close(hh); end
+        if options_.occbin.likelihood.waitbar; dyn_waitbar_close(hh_fig); end
         return
     end
 end
 if options_.occbin.likelihood.waitbar
-    dyn_waitbar_close(hh);
+    dyn_waitbar_close(hh_fig);
 end
 
 end
\ No newline at end of file
diff --git a/matlab/+occbin/graph.m b/matlab/+occbin/graph.m
index 8aafca77a3..938d4f636c 100644
--- a/matlab/+occbin/graph.m
+++ b/matlab/+occbin/graph.m
@@ -8,7 +8,7 @@ function graph(M_, options_, options_occbin_, oo_, var_list)
 % - oo_                 [structure]     Matlab's structure containing the results
 % - var_list            [char]          list of the variables to plot 
 
-% Copyright © 2021 Dynare Team
+% Copyright © 2021-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -79,7 +79,7 @@ end
 [nbplt,nr,nc,lr,lc,nstar] = pltorg(number_of_plots_to_draw_endo+number_of_plots_to_draw_exo);
 
 for fig = 1:nbplt
-    hh = dyn_figure(options_.nodisplay,'Name',['Occbin simulated paths, figure ' int2str(fig)]);
+    hh_fig = dyn_figure(options_.nodisplay,'Name',['Occbin simulated paths, figure ' int2str(fig)]);
     for plt = 1:nstar
         if fig==nbplt && ~lr==0
             subplot(lr,lc,plt);
@@ -121,7 +121,7 @@ for fig = 1:nbplt
             break
         end
     end
-    dyn_saveas(hh,[M_.dname, '/graphs/'  M_.fname '_occbin_' int2str(fig)],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[M_.dname, '/graphs/'  M_.fname '_occbin_' int2str(fig)],options_.nodisplay,options_.graph_format);
     if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
         fprintf(fidTeX,'\\begin{figure}[H]\n');
         fprintf(fidTeX,'\\centering \n');
diff --git a/matlab/+occbin/solve_one_constraint.m b/matlab/+occbin/solve_one_constraint.m
index 2f7834df9d..54ff78cfb2 100644
--- a/matlab/+occbin/solve_one_constraint.m
+++ b/matlab/+occbin/solve_one_constraint.m
@@ -114,13 +114,13 @@ else
 end
 
 if opts_simul_.waitbar
-    hh = dyn_waitbar(0,'Occbin: Solving the model');
-    set(hh,'Name','Occbin: Solving the model.');
+    hh_fig = dyn_waitbar(0,'Occbin: Solving the model');
+    set(hh_fig,'Name','Occbin: Solving the model.');
 end
 
 for shock_period = 1:n_shocks_periods
     if opts_simul_.waitbar
-        dyn_waitbar(shock_period/n_shocks_periods, hh, sprintf('Period %u of %u', shock_period,n_shocks_periods));
+        dyn_waitbar(shock_period/n_shocks_periods, hh_fig, sprintf('Period %u of %u', shock_period,n_shocks_periods));
     end
     
     regime_change_this_iteration=true;
@@ -312,7 +312,7 @@ for shock_period = 1:n_shocks_periods
                 if periodic_solution
                     disp_verbose(['Max error:' num2str(merr) '.'],opts_simul_.debug)
                 else
-                    if opts_simul_.waitbar; dyn_waitbar_close(hh); end
+                    if opts_simul_.waitbar; dyn_waitbar_close(hh_fig); end
                     error_flag = 310;
                     return
                 end
@@ -324,7 +324,7 @@ for shock_period = 1:n_shocks_periods
                 disp_verbose('Did not converge -- increase maxit.',opts_simul_.debug)
                     error_flag = 311;
                 end
-                if opts_simul_.waitbar; dyn_waitbar_close(hh); end
+                if opts_simul_.waitbar; dyn_waitbar_close(hh_fig); end
                 return
             end
         else
@@ -333,7 +333,7 @@ for shock_period = 1:n_shocks_periods
     end
     if any(error_code_period)
         disp_verbose('Increase nperiods.',opts_simul_.debug)
-        if opts_simul_.waitbar; dyn_waitbar_close(hh); end
+        if opts_simul_.waitbar; dyn_waitbar_close(hh_fig); end
         error_flag = 312;
         return
     end
@@ -363,5 +363,5 @@ if ~opts_simul_.piecewise_only
 end
 
 if opts_simul_.waitbar
-    dyn_waitbar_close(hh); 
+    dyn_waitbar_close(hh_fig); 
 end
diff --git a/matlab/+occbin/solve_two_constraints.m b/matlab/+occbin/solve_two_constraints.m
index eab9c269b6..79dadc8696 100644
--- a/matlab/+occbin/solve_two_constraints.m
+++ b/matlab/+occbin/solve_two_constraints.m
@@ -124,13 +124,13 @@ else
 end
 
 if opts_simul_.waitbar
-    hh = dyn_waitbar(0,'Occbin: Solving the model');
-    set(hh,'Name','Occbin: Solving the model.');
+    hh_fig = dyn_waitbar(0,'Occbin: Solving the model');
+    set(hh_fig,'Name','Occbin: Solving the model.');
 end
 
 for shock_period = 1:n_shocks_periods
     if opts_simul_.waitbar
-        dyn_waitbar(shock_period/n_shocks_periods, hh, sprintf('Period %u of %u', shock_period,n_shocks_periods));
+        dyn_waitbar(shock_period/n_shocks_periods, hh_fig, sprintf('Period %u of %u', shock_period,n_shocks_periods));
     end
     regime_change_this_iteration=true;
     nperiods_endogenously_increased = false;
@@ -348,7 +348,7 @@ for shock_period = 1:n_shocks_periods
                     disp_verbose(['Max error:' num2str(min_err) '.'],opts_simul_.debug)
                 else
                     error_flag = 310;
-                    if opts_simul_.waitbar; dyn_waitbar_close(hh); end
+                    if opts_simul_.waitbar; dyn_waitbar_close(hh_fig); end
                     return;
                 end
             else
@@ -359,7 +359,7 @@ for shock_period = 1:n_shocks_periods
                     disp_verbose('Did not converge -- increase maxit.',opts_simul_.debug)
                     error_flag = 311;
                 end
-                if opts_simul_.waitbar; dyn_waitbar_close(hh); end
+                if opts_simul_.waitbar; dyn_waitbar_close(hh_fig); end
                 return;
             end
         else
@@ -371,7 +371,7 @@ for shock_period = 1:n_shocks_periods
     if any(error_code_period)
         disp_verbose('Increase nperiods.',opts_simul_.debug)
         error_flag = 312;
-        if opts_simul_.waitbar; dyn_waitbar_close(hh); end
+        if opts_simul_.waitbar; dyn_waitbar_close(hh_fig); end
         return;
     end
     
@@ -396,5 +396,5 @@ if ~opts_simul_.piecewise_only
 end
 
 if opts_simul_.waitbar
-    dyn_waitbar_close(hh); 
+    dyn_waitbar_close(hh_fig); 
 end
diff --git a/matlab/DSMH_sampler.m b/matlab/DSMH_sampler.m
index f1724a5608..35621f8ffa 100644
--- a/matlab/DSMH_sampler.m
+++ b/matlab/DSMH_sampler.m
@@ -33,7 +33,7 @@ function DSMH_sampler(TargetFun,xparam1,mh_bounds,dataset_,dataset_info,options_
 % Then the comments write here can be used for all the other pairs of
 % parallel functions and also for management functions.
 
-% Copyright © 2006-2022 Dynare Team
+% Copyright © 2006-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -125,7 +125,7 @@ if TeX
     NAMES = [];
     TeXNAMES = [];
 end
-hh = dyn_figure(options_.nodisplay,'Name','Parameters Densities');
+hh_fig = dyn_figure(options_.nodisplay,'Name','Parameters Densities');
 for k=1:npar %min(nstar,npar-(plt-1)*nstar)
     subplot(ceil(sqrt(npar)),floor(sqrt(npar)),k)
     %kk = (plt-1)*nstar+k;
@@ -144,7 +144,7 @@ for k=1:npar %min(nstar,npar-(plt-1)*nstar)
     axis tight
     drawnow
 end
-dyn_saveas(hh,[ M_.fname '_param_density' int2str(plt) ],options_.nodisplay,options_.graph_format);
+dyn_saveas(hh_fig,[ M_.fname '_param_density' int2str(plt) ],options_.nodisplay,options_.graph_format);
 if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
     % TeX eps loader file
     fprintf(fidTeX,'\\begin{figure}[H]\n');
diff --git a/matlab/Herbst_Schorfheide_sampler.m b/matlab/Herbst_Schorfheide_sampler.m
index b73b8f87b6..8db32815fe 100644
--- a/matlab/Herbst_Schorfheide_sampler.m
+++ b/matlab/Herbst_Schorfheide_sampler.m
@@ -33,7 +33,7 @@ function Herbst_Schorfheide_sampler(TargetFun,xparam1,mh_bounds,dataset_,dataset
 % Then the comments write here can be used for all the other pairs of
 % parallel functions and also for management functions.
 
-% Copyright © 2006-2022 Dynare Team
+% Copyright © 2006-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -152,7 +152,7 @@ if TeX
     NAMES = [];
     TeXNAMES = [];
 end
-hh = dyn_figure(options_.nodisplay,'Name','Parameters Densities');
+hh_fig = dyn_figure(options_.nodisplay,'Name','Parameters Densities');
 for k=1:npar %min(nstar,npar-(plt-1)*nstar)
     subplot(ceil(sqrt(npar)),floor(sqrt(npar)),k)
     %kk = (plt-1)*nstar+k;
@@ -171,7 +171,7 @@ for k=1:npar %min(nstar,npar-(plt-1)*nstar)
     axis tight
     drawnow
 end
-dyn_saveas(hh,[ M_.fname '_param_density' int2str(plt) ],options_.nodisplay,options_.graph_format);
+dyn_saveas(hh_fig,[ M_.fname '_param_density' int2str(plt) ],options_.nodisplay,options_.graph_format);
 if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
     % TeX eps loader file
     fprintf(fidTeX,'\\begin{figure}[H]\n');
diff --git a/matlab/MakeAllFigures.m b/matlab/MakeAllFigures.m
index 2e18af357c..e14f865795 100644
--- a/matlab/MakeAllFigures.m
+++ b/matlab/MakeAllFigures.m
@@ -1,6 +1,6 @@
 function MakeAllFigures(NumberOfPlots,Caption,FigureProperties,Info)
 
-% Copyright © 2005-2017 Dynare Team
+% Copyright © 2005-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -97,45 +97,45 @@ for plt = 1:NumberOfPlots
     subplot(nr,nc,plt)
     hold on
     for curve = 1:NumberOfCurves
-        hh = plot(x{curve},y{curve});
+        hh_fig = plot(x{curve},y{curve});
         if strcmpi(PltType{curve},'PriorDensity')
-            set(hh,'Color',[0.7 0.7 0.7],'LineStyle','-','LineWidth',2)
+            set(hh_fig,'Color',[0.7 0.7 0.7],'LineStyle','-','LineWidth',2)
             %
             %
         elseif strcmpi(PltType{curve},'DensityEstimate')
-            set(hh,'Color','k','LineStyle','-','LineWidth',2)
+            set(hh_fig,'Color','k','LineStyle','-','LineWidth',2)
             %
             %
         elseif strcmpi(PltType{curve},'ModeEstimate')
-            set(hh,'Color','g','LineStyle','--','LineWidth',2)
+            set(hh_fig,'Color','g','LineStyle','--','LineWidth',2)
             %
             %
         elseif strcmpi(PltType{curve},'SmoothVariable')
-            set(hh,'Color','k','LineStyle','-','LineWidth',2)
+            set(hh_fig,'Color','k','LineStyle','-','LineWidth',2)
             %
             %
         elseif strcmpi(PltType{curve},'Deciles')
-            set(hh,'Color','g','LineStyle','-','LineWidth',1)
+            set(hh_fig,'Color','g','LineStyle','-','LineWidth',1)
             %
             %
         elseif strcmpi(PltType{curve},'Forecasts')
-            set(hh,'Color','','LineStyle','-','LineWidth',2)
+            set(hh_fig,'Color','','LineStyle','-','LineWidth',2)
             %
             %
         elseif strcmpi(PltType{curve},'ForecastsHPD')
-            set(hh,'Color','k','LineStyle','-','LineWidth',1)
+            set(hh_fig,'Color','k','LineStyle','-','LineWidth',1)
             %
             %
         elseif strcmpi(PltType{curve},'ForecastsDeciles')
-            set(hh,'Color','g','LineStyle','-','LineWidth',1)
+            set(hh_fig,'Color','g','LineStyle','-','LineWidth',1)
             %
             %
         elseif strcmpi(PltType{curve},'DiagnosticWithin')
-            set(hh,'Color','b','LineStyle','-','LineWidth',2)
+            set(hh_fig,'Color','b','LineStyle','-','LineWidth',2)
             %
             %
         elseif strcmpi(PltType{curve},'DiagnosticPooled')
-            set(hh,'Color','r','LineStyle','-','LineWidth',2)
+            set(hh_fig,'Color','r','LineStyle','-','LineWidth',2)
             %
             %
         end
diff --git a/matlab/PlotPosteriorDistributions.m b/matlab/PlotPosteriorDistributions.m
index 376810db22..7da52aa723 100644
--- a/matlab/PlotPosteriorDistributions.m
+++ b/matlab/PlotPosteriorDistributions.m
@@ -128,8 +128,8 @@ for i=1:npar
     borneinf = min(binf1, binf2);
     bornesup = max(bsup1, bsup2);
     subplot(nn, nn, subplotnum)
-    hh_fig = plot(x2, f2, '-k', 'linewidth', 2);
-    set(hh_fig, 'color', [0.7 0.7 0.7]);
+    hh_plt = plot(x2, f2, '-k', 'linewidth', 2);
+    set(hh_plt, 'color', [0.7 0.7 0.7]);
     hold on;
     plot(x1, f1, '-k', 'linewidth', 2);
     if ~options_.mh_posterior_mode_estimation
diff --git a/matlab/PosteriorIRF_core2.m b/matlab/PosteriorIRF_core2.m
index f9fa28ab94..73ea4c493e 100644
--- a/matlab/PosteriorIRF_core2.m
+++ b/matlab/PosteriorIRF_core2.m
@@ -30,7 +30,7 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam,ThisMatlab)
 % SPECIAL REQUIREMENTS.
 %   None.
 %
-% Copyright © 2006-2018 Dynare Team
+% Copyright © 2006-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -103,12 +103,12 @@ for i=fpar:npar
         if max(abs(MeanIRF(:,j,i))) >= options_.impulse_responses.plot_threshold
             subplotnum = subplotnum+1;
             if subplotnum == 1 && options_.relative_irf
-                hh = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock to ' tit{i}]);
+                hh_fig = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock to ' tit{i}]);
             elseif subplotnum == 1 && ~options_.relative_irf
-                hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i}]);
+                hh_fig = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i}]);
             end
 
-            set(0,'CurrentFigure',hh)
+            set(0,'CurrentFigure',hh_fig)
             subplot(nn,nn,subplotnum);
             if ~MAX_nirfs_dsgevar
                 if ~isnan(min(HPDIRF(:,1,j,i)))
@@ -155,7 +155,7 @@ for i=fpar:npar
 
         if subplotnum == MaxNumberOfPlotPerFigure || (j == nvar  && subplotnum> 0)
             figunumber = figunumber+1;
-            dyn_saveas(hh,[DirectoryName '/'  M_.fname '_Bayesian_IRF_' tit{i} '_' int2str(figunumber)],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[DirectoryName '/'  M_.fname '_Bayesian_IRF_' tit{i} '_' int2str(figunumber)],options_.nodisplay,options_.graph_format);
             if RemoteFlag==1
                 OutputFileName = [OutputFileName; {[DirectoryName,filesep], [M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber) '.*']}];
             end
diff --git a/matlab/UnivariateSpectralDensity.m b/matlab/UnivariateSpectralDensity.m
index d829ba3f30..862dde5e61 100644
--- a/matlab/UnivariateSpectralDensity.m
+++ b/matlab/UnivariateSpectralDensity.m
@@ -19,7 +19,7 @@ function [oo_] = UnivariateSpectralDensity(M_,oo_,options_,var_list)
 
 % Adapted from th_autocovariances.m.
 
-% Copyright © 2006-2020 Dynare Team
+% Copyright © 2006-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -155,12 +155,12 @@ if ~options_.nograph
     end
 
     for i= 1:nvar
-        hh = dyn_figure(options_.nodisplay,'Name',['Spectral Density of ' M_.endo_names{ivar(i)} '.']);
+        hh_fig = dyn_figure(options_.nodisplay,'Name',['Spectral Density of ' M_.endo_names{ivar(i)} '.']);
         plot(freqs,f(i,:),'-k','linewidth',2)
         xlabel('0 \leq \omega \leq \pi')
         ylabel('f(\omega)')
         box on
         axis tight
-        dyn_saveas(hh,[M_.dname ,filesep,'graphs', filesep, 'SpectralDensity_' M_.endo_names{ivar(i)}],options_.nodisplay,options_.graph_format)
+        dyn_saveas(hh_fig,[M_.dname ,filesep,'graphs', filesep, 'SpectralDensity_' M_.endo_names{ivar(i)}],options_.nodisplay,options_.graph_format)
     end
 end
diff --git a/matlab/calibrate_mh_scale_parameter.m b/matlab/calibrate_mh_scale_parameter.m
index af940fb333..0a5d0a2536 100644
--- a/matlab/calibrate_mh_scale_parameter.m
+++ b/matlab/calibrate_mh_scale_parameter.m
@@ -20,7 +20,7 @@ function Scale = calibrate_mh_scale_parameter(ObjectiveFunction, CovarianceMatri
 
 
 
-% Copyright © 2020-2021 Dynare Team
+% Copyright © 2020-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -38,8 +38,8 @@ function Scale = calibrate_mh_scale_parameter(ObjectiveFunction, CovarianceMatri
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 % Fire up the wait bar
-hh = dyn_waitbar(0,'Tuning of the scale parameter...');
-set(hh,'Name','Tuning of the scale parameter.');
+hh_fig = dyn_waitbar(0,'Tuning of the scale parameter...');
+set(hh_fig,'Name','Tuning of the scale parameter.');
 
 % Intilialize various counters.
 j = 1; jj  = 1; isux = 0; jsux = 0; i = 0;
@@ -100,7 +100,7 @@ while j<=options.maxiter
     prtfrc = j/options.maxiter;
     % Update the waitbar
     if ~mod(j, 10)
-        dyn_waitbar(prtfrc, hh, sprintf('Acceptance ratio [during last %u]: %f [%f]', options.stepsize, isux/j, jsux/jj));
+        dyn_waitbar(prtfrc, hh_fig, sprintf('Acceptance ratio [during last %u]: %f [%f]', options.stepsize, isux/j, jsux/jj));
     end
     % Adjust the value of the scale parameter.
     if ~mod(j, options.stepsize)
@@ -135,4 +135,4 @@ while j<=options.maxiter
     jj = jj + 1;
 end
 
-dyn_waitbar_close(hh);
\ No newline at end of file
+dyn_waitbar_close(hh_fig);
\ No newline at end of file
diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m
index 15ef024f20..14e90d403b 100644
--- a/matlab/dynare_estimation.m
+++ b/matlab/dynare_estimation.m
@@ -12,7 +12,7 @@ function oo_recursive_=dynare_estimation(var_list,dname)
 % SPECIAL REQUIREMENTS
 %   none
 
-% Copyright © 2003-2021 Dynare Team
+% Copyright © 2003-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -164,7 +164,7 @@ if nnobs > 1 && horizon > 0
     for i = 1:length(var_list)
         if mod(i,nstar) == 1
             plot_index=plot_index+1;
-            hfig = dyn_figure(options_.nodisplay,'Name',['Out of sample forecasts (',num2str(plot_index),')']);
+            hh_fig = dyn_figure(options_.nodisplay,'Name',['Out of sample forecasts (',num2str(plot_index),')']);
             m = 1;
         end
         subplot(nr,nc,m)
@@ -221,7 +221,7 @@ if nnobs > 1 && horizon > 0
         xlim([nobs(1)-offsetx nobs(end)+horizon])
         m = m + 1;
         if mod(i+1,nstar) == 1 || i==length(var_list)
-            dyn_saveas(hfig,[M_.dname,filesep,'graphs',filesep M_.fname '_RecursiveForecasts_' int2str(plot_index)],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[M_.dname,filesep,'graphs',filesep M_.fname '_RecursiveForecasts_' int2str(plot_index)],options_.nodisplay,options_.graph_format);
         end
     end
 end
diff --git a/matlab/dyntable.m b/matlab/dyntable.m
index 29d0b6c9a7..47d24fc297 100644
--- a/matlab/dyntable.m
+++ b/matlab/dyntable.m
@@ -15,7 +15,7 @@ function dyntable(options_, title, headers, labels, values, label_width, val_wid
 % OUTPUTS
 % none
 
-% Copyright © 2002-2022 Dynare Team
+% Copyright © 2002-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -73,11 +73,11 @@ if nargin==9
 end
 
 if length(headers) > 0
-    hh = sprintf(label_format_leftbound , headers{1});
+    hh_tbl = sprintf(label_format_leftbound , headers{1});
     for i=2:length(headers)
-        hh  = [hh sprintf(header_string_format, headers{i})];
+        hh_tbl  = [hh_tbl sprintf(header_string_format, headers{i})];
     end
-    disp(hh)
+    disp(hh_tbl)
 end
 
 for i=1:size(values,1)
diff --git a/matlab/ep/extended_path.m b/matlab/ep/extended_path.m
index 0b4bfb1ef5..d94aa1f0bc 100644
--- a/matlab/ep/extended_path.m
+++ b/matlab/ep/extended_path.m
@@ -19,7 +19,7 @@ function [ts, DynareResults] = extended_path(initialconditions, samplesize, exog
 %
 % SPECIAL REQUIREMENTS
 
-% Copyright © 2009-2020 Dynare Team
+% Copyright © 2009-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -46,8 +46,8 @@ endogenous_variables_paths = NaN(DynareModel.endo_nbr,samplesize+1);
 endogenous_variables_paths(:,1) = initialconditions;
 
 % Set waitbar (graphic or text  mode)
-hh = dyn_waitbar(0,'Please wait. Extended Path simulations...');
-set(hh,'Name','EP simulations.');
+hh_fig = dyn_waitbar(0,'Please wait. Extended Path simulations...');
+set(hh_fig,'Name','EP simulations.');
 
 % Initialize while-loop index.
 t = 1;
@@ -55,7 +55,7 @@ t = 1;
 % Main loop.
 while (t <= samplesize)
     if ~mod(t,10)
-        dyn_waitbar(t/samplesize,hh,'Please wait. Extended Path simulations...');
+        dyn_waitbar(t/samplesize,hh_fig,'Please wait. Extended Path simulations...');
     end
     % Set period index.
     t = t+1;
@@ -83,7 +83,7 @@ while (t <= samplesize)
 end % (while) loop over t
 
 % Close waitbar.
-dyn_waitbar_close(hh);
+dyn_waitbar_close(hh_fig);
 
 % Set the initial period.
 if isdates(DynareOptions.initial_period)
diff --git a/matlab/forecast_graphs.m b/matlab/forecast_graphs.m
index fffcbe359e..6bc15522f2 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 © 2008-2018 Dynare Team
+% Copyright © 2008-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -61,11 +61,11 @@ end
 
 m = 1;
 n_fig = 1;
-hh = dyn_figure(options_.nodisplay, 'Name', 'Forecasts (I)');
+hh_fig = dyn_figure(options_.nodisplay, 'Name', 'Forecasts (I)');
 
 for j= 1:nvar
     if m > nc*nr
-        dyn_saveas(hh,[ dname '/graphs/forcst' int2str(n_fig)], options_.nodisplay, options_.graph_format);
+        dyn_saveas(hh_fig,[ dname '/graphs/forcst' int2str(n_fig)], options_.nodisplay, options_.graph_format);
         if options_.TeX && any(strcmp('eps', cellstr(options_.graph_format)))
             fprintf(fidTeX,'\\begin{figure}[H]\n');
             fprintf(fidTeX,'\\centering \n');
@@ -76,7 +76,7 @@ for j= 1:nvar
             fprintf(fidTeX,' \n');
         end
         n_fig =n_fig+1;
-        eval(['hh=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
+        eval(['hh_fig=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
         m = 1;
     end
     subplot(nr, nc, m);
@@ -99,7 +99,7 @@ for j= 1:nvar
 end
 
 if m > 1
-    dyn_saveas(hh,[dname '/graphs/forcst' int2str(n_fig)],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[dname '/graphs/forcst' int2str(n_fig)],options_.nodisplay,options_.graph_format);
     if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
         fprintf(fidTeX,'\\begin{figure}[H]\n');
         fprintf(fidTeX,'\\centering \n');
@@ -124,10 +124,10 @@ if isfield(oo_.forecast,'HPDinf_ME')
 
     m = 1;
     n_fig = 1;
-    hh=dyn_figure(options_.nodisplay,'Name','Forecasts including ME (I)');
+    hh_fig=dyn_figure(options_.nodisplay,'Name','Forecasts including ME (I)');
     for j= 1:length(var_names)
         if m > nc*nr
-            dyn_saveas(hh,[ dname '/graphs/forcst_ME' int2str(n_fig)],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[ dname '/graphs/forcst_ME' int2str(n_fig)],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fprintf(fidTeX,'\\begin{figure}[H]\n');
                 fprintf(fidTeX,'\\centering \n');
@@ -138,7 +138,7 @@ if isfield(oo_.forecast,'HPDinf_ME')
                 fprintf(fidTeX,' \n');
             end
             n_fig =n_fig+1;
-            eval(['hh=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
+            eval(['hh_fig=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
             m = 1;
         end
         subplot(nr,nc,m);
@@ -162,7 +162,7 @@ if isfield(oo_.forecast,'HPDinf_ME')
     end
 
     if m > 1
-        dyn_saveas(hh,[dname '/graphs/forcst_ME' int2str(n_fig)],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dname '/graphs/forcst_ME' int2str(n_fig)],options_.nodisplay,options_.graph_format);
         if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
             fprintf(fidTeX,'\\begin{figure}[H]\n');
             fprintf(fidTeX,'\\centering \n');
diff --git a/matlab/gsa/filt_mc_.m b/matlab/gsa/filt_mc_.m
index 02549596cf..ebe9ca9eee 100644
--- a/matlab/gsa/filt_mc_.m
+++ b/matlab/gsa/filt_mc_.m
@@ -391,7 +391,7 @@ else
             end
             if mod(i,9)==1
                 ifig=ifig+1;
-                hh=dyn_figure(options_.nodisplay,'name',[temp_name,' ',int2str(ifig)]);
+                hh_fig=dyn_figure(options_.nodisplay,'name',[temp_name,' ',int2str(ifig)]);
             end
             subplot(3,3,i-9*(ifig-1))
             h=cumplot(lnprior(ixx(1:nfilt0(i),i)));
@@ -407,18 +407,18 @@ else
                     annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-prior for WORSE R2', 'Color','Red','horizontalalignment','center');
                 end
                 if options_.opt_gsa.ppost
-                    dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],options_.nodisplay,options_.graph_format);
                     if options_.TeX
                         create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
                     end
                 else
                     if options_.opt_gsa.pprior
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
                         end
                     else
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
                         end
@@ -439,7 +439,7 @@ else
             end
             if mod(i,9)==1
                 ifig=ifig+1;
-                hh = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
+                hh_fig = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
             end
             subplot(3,3,i-9*(ifig-1))
             h=cumplot(likelihood(ixx(1:nfilt0(i),i)));
@@ -458,18 +458,18 @@ else
                     annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-likelihood for WORSE R2', 'Color','Red','horizontalalignment','center');
                 end
                 if options_.opt_gsa.ppost
-                    dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_post_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
                     if options_.TeX
                         create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
                     end
                 else
                     if options_.opt_gsa.pprior
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnlik',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
                         end
                     else
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnlik',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
                         end
@@ -490,7 +490,7 @@ else
             end
             if mod(i,9)==1
                 ifig=ifig+1;
-                hh = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
+                hh_fig = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
             end
             subplot(3,3,i-9*(ifig-1))
             h=cumplot(logpo2(ixx(1:nfilt0(i),i)));
@@ -509,18 +509,18 @@ else
                     annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-posterior for WORSE R2', 'Color','Red','horizontalalignment','center');
                 end
                 if options_.opt_gsa.ppost
-                    dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],options_.nodisplay,options_.graph_format);
                     if options_.TeX
                         create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
                     end
                 else
                     if options_.opt_gsa.pprior
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
                         end
                     else
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
                         end
@@ -746,7 +746,7 @@ else
         for iy = 1:length(vvarvecm)
             ipar = find(any(squeeze(PPV(iy,:,:))<alpha));
             for ix=1:ceil(length(ipar)/5)
-                hh = dyn_figure(options_.nodisplay,'name',[temp_name,' observed variable ', vvarvecm{iy}]);
+                hh_fig = dyn_figure(options_.nodisplay,'name',[temp_name,' observed variable ', vvarvecm{iy}]);
                 for j=1+5*(ix-1):min(length(ipar),5*ix)
                     subplot(2,3,j-5*(ix-1))
                     h0=cumplot(x(:,ipar(j)));
@@ -782,18 +782,18 @@ else
                     set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
                 end
                 if options_.opt_gsa.ppost
-                    dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
                     if options_.TeX
                         create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_post_' vvarvecm{iy}],1)
                     end
                 else
                     if options_.opt_gsa.pprior
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_prior_' vvarvecm{iy}],1)
                         end
                     else
-                        dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
                         if options_.TeX
                             create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_mc_' vvarvecm{iy}],1)
                         end
@@ -803,7 +803,7 @@ else
         end
         % now I plot by individual parameters
         for ix=1:ceil(length(nsnam)/5)
-            hh = dyn_figure(options_.nodisplay,'name',[temp_name,' estimated params and shocks ',int2str(ix)]);
+            hh_fig = dyn_figure(options_.nodisplay,'name',[temp_name,' estimated params and shocks ',int2str(ix)]);
             for j=1+5*(ix-1):min(size(snam2,1),5*ix)
                 subplot(2,3,j-5*(ix-1))
                 h0=cumplot(x(:,nsnam(j)));
@@ -840,18 +840,18 @@ else
                 set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
             end
             if options_.opt_gsa.ppost
-                dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
+                dyn_saveas(hh_fig,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
                 if options_.TeX
                     create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],ix,[temp_name,' estimated params and shocks ',int2str(ix)],'rmse_post_params',1)
                 end
             else
                 if options_.opt_gsa.pprior
-                    dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_params_' int2str(ix) ],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_prior_params_' int2str(ix) ],options_.nodisplay,options_.graph_format);
                     if options_.TeX
                         create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_params_' int2str(ix) ],ix,[temp_name,' estimated params and shocks ',int2str(ix)],'rmse_prior_params',1)
                     end
                 else
-                    dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[OutDir filesep fname_ '_rmse_mc_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
                     if options_.TeX
                         create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_params_' int2str(ix)],ix,[temp_name,' estimated params and shocks ',int2str(ix)],'rmse_mc_params',1)
                     end
diff --git a/matlab/gsa/map_ident_.m b/matlab/gsa/map_ident_.m
index 73eb02fbc9..7a1b525f1e 100644
--- a/matlab/gsa/map_ident_.m
+++ b/matlab/gsa/map_ident_.m
@@ -5,7 +5,7 @@ function map_ident_(OutputDirectoryName,opt_gsa)
 % marco.ratto@ec.europa.eu
 
 % Copyright © 2012-2016 European Commission
-% Copyright © 2012-2018 Dynare Team
+% Copyright © 2012-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -90,7 +90,7 @@ if opt_gsa.load_ident_files==0
         ifig=0;
         for j=1:M_.exo_nbr
             if mod(j,6)==1
-                hh=dyn_figure(options_.nodisplay,'name',['Variance decomposition shocks']);
+                hh_fig=dyn_figure(options_.nodisplay,'name',['Variance decomposition shocks']);
                 ifig=ifig+1;
                 iplo=0;
             end
@@ -108,7 +108,7 @@ if opt_gsa.load_ident_files==0
             ylabel(' ')
             title(M_.exo_names{j},'interpreter','none')
             if mod(j,6)==0 | j==M_.exo_nbr
-                dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],options_.nodisplay,options_.graph_format);
+                dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],options_.nodisplay,options_.graph_format);
                 create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],ifig,['Variance decomposition shocks'],'vdec_exo',options_.figures.textwidth*min(iplo/3,1))
             end
         end
@@ -219,7 +219,7 @@ if opt_gsa.morris==1
             load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'SAvdec','vdec','ir_vdec','ic_vdec')
         end
 
-        hh = dyn_figure(options_.nodisplay,'name','Screening identification: variance decomposition');
+        hh_fig = dyn_figure(options_.nodisplay,'name','Screening identification: variance decomposition');
         %   boxplot(SAvdec,'whis',10,'symbol','r.')
         myboxplot(SAvdec,[],'.',[],10)
         set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -232,7 +232,7 @@ if opt_gsa.morris==1
         end
         xlabel(' ')
         title('Elementary effects variance decomposition')
-        dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_vdec'],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morris_vdec'],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_vdec'],1,'Screening identification: variance decomposition','morris_vdec',1)
     else
         save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'vdec')
@@ -325,7 +325,7 @@ if opt_gsa.morris==1
         load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'ac','ir_ac','ic_ac')
     end
 
-    hh=dyn_figure(options_.nodisplay,'name','Screening identification: theoretical moments');
+    hh_fig=dyn_figure(options_.nodisplay,'name','Screening identification: theoretical moments');
     %   boxplot(SAcc,'whis',10,'symbol','r.')
     myboxplot(SAcc,[],'.',[],10)
     set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -338,7 +338,7 @@ if opt_gsa.morris==1
     end
     xlabel(' ')
     title('Elementary effects in the moments')
-    dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_moments'],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morris_moments'],options_.nodisplay,options_.graph_format);
     create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_moments'],1,'Screening identification: theoretical moments','morris_moments',1)
 
     %   close(gcf),
@@ -722,7 +722,7 @@ if opt_gsa.morris==1
     else
         load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'SAnorm','SAmunorm','SAsignorm')
     end
-    hh=dyn_figure(options_.nodisplay,'name','Screening identification: model'); %bar(SAnorm(:,irel))
+    hh_fig=dyn_figure(options_.nodisplay,'name','Screening identification: model'); %bar(SAnorm(:,irel))
                                                                                 %   boxplot(SAnorm','whis',10,'symbol','r.')
     myboxplot(SAnorm',[],'.',[],10)
     set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -736,10 +736,10 @@ if opt_gsa.morris==1
     end
     xlabel(' ')
     title('Elementary effects in the model')
-    dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_par'],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morris_par'],options_.nodisplay,options_.graph_format);
     create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_par'],1,'Screening identification: model','morris_par',1)
 
-    %   hh=dyn_figure(options_.nodisplay); %bar(SAmunorm(:,irel))
+    %   hh_fig=dyn_figure(options_.nodisplay); %bar(SAmunorm(:,irel))
     % %   boxplot(SAmunorm','whis',10,'symbol','r.')
     %   myboxplot(SAmunorm',[],'.',[],10)
     %   set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -752,9 +752,9 @@ if opt_gsa.morris==1
     %   end
     %   xlabel(' ')
     %   title('\mu in the model')
-    %   dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morrismu_par'],options_.nodisplay,options_.graph_format);
+    %   dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morrismu_par'],options_.nodisplay,options_.graph_format);
     %
-    %   hh=dyn_figure(options_.nodisplay); %bar(SAsignorm(:,irel))
+    %   hh_fig=dyn_figure(options_.nodisplay); %bar(SAsignorm(:,irel))
     % %   boxplot(SAsignorm','whis',10,'symbol','r.')
     %   myboxplot(SAsignorm',[],'.',[],10)
     %   set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -767,7 +767,7 @@ if opt_gsa.morris==1
     %   end
     %   xlabel(' ')
     %   title('\sigma in the model')
-    %   dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morrissig_par'],options_.nodisplay,options_.graph_format);
+    %   dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_morrissig_par'],options_.nodisplay,options_.graph_format);
 
     %     figure, bar(SAnorm(:,irel)')
     %     set(gca,'xtick',[1:j0])
@@ -1521,7 +1521,7 @@ else  % main effects analysis
     %   SAmeanexo=mean(SAmomN(:,1:nshock));
 
     %   figure, bar(latent'*SAcc),
-    hh=dyn_figure(options_.nodisplay,'Name',['Identifiability indices in the ',fsuffix,' moments.']);
+    hh_fig=dyn_figure(options_.nodisplay,'Name',['Identifiability indices in the ',fsuffix,' moments.']);
     bar(sum(SAcc))
     set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
     set(gca,'xlim',[0.5 npT+0.5])
@@ -1534,7 +1534,7 @@ else  % main effects analysis
     end
     xlabel(' ')
     title(['Identifiability indices in the ',fsuffix,' moments.'],'interpreter','none')
-    dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_ident_ALL',fsuffix],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[OutputDirectoryName,'/',fname_,'_ident_ALL',fsuffix],options_.nodisplay,options_.graph_format);
     create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_ident_ALL',fsuffix],1,['Identifiability indices in the ',fsuffix,' moments.'],['ident_ALL',fsuffix]',1)
 
     %   figure, bar(SAmeanexo),
diff --git a/matlab/gsa/pick.m b/matlab/gsa/pick.m
index 7e63244b57..de1cdabaf8 100644
--- a/matlab/gsa/pick.m
+++ b/matlab/gsa/pick.m
@@ -1,7 +1,7 @@
 function pick
 %
 % Copyright © 2001-2017 European Commission
-% Copyright © 2017 DynareTeam
+% Copyright © 2017-2023 DynareTeam
 
 % This file is part of GLUEWIN
 % GLUEWIN is a MATLAB code designed for analysing the output
@@ -68,9 +68,9 @@ KK=K;
 
 set(button1,'Label',['Save ',num2str(K)],'Callback',['scatter_callback(',num2str(KK),',''save'')']);
 set(button2,'Label',['Eval ',num2str(K)],'Callback',['scatter_callback(',num2str(KK),',''eval'')']);
-hh=findobj(gcf,'type','axes','Tag','scatter');
-for k=1:length(hh)
-    axes(hh(k));
+hh_obj=findobj(gcf,'type','axes','Tag','scatter');
+for k=1:length(hh_obj)
+    axes(hh_obj(k));
     dum=get(gca,'children');
     dumx=get(dum(end),'xdata');
     dumy=get(dum(end),'ydata');
diff --git a/matlab/gsa/redform_map.m b/matlab/gsa/redform_map.m
index dbdd586fba..1dd6f0d1b9 100644
--- a/matlab/gsa/redform_map.m
+++ b/matlab/gsa/redform_map.m
@@ -16,7 +16,7 @@ function redform_map(dirname,options_gsa_)
 % marco.ratto@ec.europa.eu
 
 % Copyright © 2012-2016 European Commission
-% Copyright © 2012-2018 Dynare Team
+% Copyright © 2012-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -165,7 +165,7 @@ for j = 1:length(anamendo)
             if (max(y0)-min(y0))>1.e-10
                 if mod(iplo,9)==0 && isempty(threshold) && ~options_.nograph
                     ifig=ifig+1;
-                    hfig = dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping: ', namendo,' vs shocks ',int2str(ifig)]);
+                    hh_fig = dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping: ', namendo,' vs shocks ',int2str(ifig)]);
                     iplo=0;
                 end
                 iplo=iplo+1;
@@ -273,7 +273,7 @@ for j = 1:length(anamendo)
                 end
 
                 if isempty(threshold) && ~options_.nograph
-                    figure(hfig)
+                    figure(hh_fig)
                     subplot(3,3,iplo),
                     if ilog
                         [saso, iso] = sort(-silog(:,js));
@@ -292,7 +292,7 @@ for j = 1:length(anamendo)
                     end
                     title([logflag,' ',namendo,' vs ',namexo],'interpreter','none')
                     if iplo==9
-                        dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
                         create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namexo,'_','\_')],['redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],1)
                     end
                 end
@@ -303,7 +303,7 @@ for j = 1:length(anamendo)
         end
     end
     if iplo<9 && iplo>0 && ifig && ~options_.nograph
-        dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namexo,'_','\_')],['redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.figures.textwidth*min(iplo/3,1))
     end
     ifig=0;
@@ -320,7 +320,7 @@ for j = 1:length(anamendo)
             if (max(y0)-min(y0))>1.e-10
                 if mod(iplo,9)==0 && isempty(threshold) && ~options_.nograph
                     ifig=ifig+1;
-                    hfig = dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping: ' namendo,' vs lags ',int2str(ifig)]);
+                    hh_fig = dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping: ' namendo,' vs lags ',int2str(ifig)]);
                     iplo=0;
                 end
                 iplo=iplo+1;
@@ -429,7 +429,7 @@ for j = 1:length(anamendo)
                 end
 
                 if isempty(threshold) && ~options_.nograph
-                    figure(hfig),
+                    figure(hh_fig),
                     subplot(3,3,iplo),
                     if ilog
                         [saso, iso] = sort(-silog(:,js));
@@ -448,7 +448,7 @@ for j = 1:length(anamendo)
                     end
                     title([logflag,' ',namendo,' vs ',namlagendo,'(-1)'],'interpreter','none')
                     if iplo==9
-                        dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
                         create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namlagendo,'_','\_'),'(-1)'],['redform_', namendo,'_vs_lags_',logflag,':',num2str(ifig)],1)
                     end
                 end
@@ -459,14 +459,14 @@ for j = 1:length(anamendo)
         end
     end
     if iplo<9 && iplo>0 && ifig && ~options_.nograph
-        dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namlagendo,'_','\_'),'(-1)'],['redform_', namendo,'_vs_lags_',logflag,':',num2str(ifig)],options_.figures.textwidth*min(iplo/3,1));
     end
 end
 
 if isempty(threshold) && ~options_.nograph
     if ilog==0
-        hfig=dyn_figure(options_.nodisplay,'name','Reduced Form GSA'); %bar(si)
+        hh_fig=dyn_figure(options_.nodisplay,'name','Reduced Form GSA'); %bar(si)
                                                                        % boxplot(si','whis',10,'symbol','r.')
         myboxplot(si',[],'.',[],10)
         xlabel(' ')
@@ -478,11 +478,11 @@ if isempty(threshold) && ~options_.nograph
             text(ip,-0.02,deblank(pnames(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
         end
         title('Reduced form GSA')
-        dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_gsa'],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,filesep,M_.fname,'_redform_gsa'],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_gsa'],'Reduced Form GSA','redform_gsa')
 
     else
-        hfig=dyn_figure(options_.nodisplay,'name','Reduced Form GSA'); %bar(silog)
+        hh_fig=dyn_figure(options_.nodisplay,'name','Reduced Form GSA'); %bar(silog)
                                                                        % boxplot(silog','whis',10,'symbol','r.')
         myboxplot(silog',[],'.',[],10)
         set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:np])
@@ -494,7 +494,7 @@ if isempty(threshold) && ~options_.nograph
             text(ip,-0.02,deblank(pnames(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
         end
         title('Reduced form GSA - Log-transformed elements')
-        dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_gsa_log'],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,filesep,M_.fname,'_redform_gsa_log'],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_gsa_log'],'Reduced form GSA - Log-transformed elements','redform_gsa_log')
 
     end
@@ -560,7 +560,7 @@ if iload==0
         y1 = log(y0*isig+lam);
     end
     if ~options_.nograph
-        hfig=dyn_figure(options_.nodisplay,'name',options_map.figtitle);
+        hh_fig=dyn_figure(options_.nodisplay,'name',options_map.figtitle);
         subplot(221)
         if ilog
             hist(y1,30)
@@ -647,7 +647,7 @@ if iload==0
     gsa_.x0=x0(ifit,:);
     %   copyfile([fname,'_est.mat'],[fname,'.mat'])
     if ~options_.nograph
-        figure(hfig);
+        figure(hh_fig);
         subplot(223),
         plot(y0(ifit),[gsa_.fit y0(ifit)],'.'),
         r2 = gsa_.r2;
@@ -672,7 +672,7 @@ if iload==0
             plot(yn,[yf yn],'.'),
             title(['Out-of-sample prediction - R2=' num2str(r2,2)],'interpreter','none')
         end
-        dyn_saveas(hfig,fname,options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,fname,options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,fname,['Out-of-sample prediction - R2=' num2str(r2,2)],'redform_gsa_log')
 
         if options_.nodisplay
@@ -685,10 +685,10 @@ else
     load([fname,'_map.mat'],'gsa_')
     if ~options_.nograph
         yf = ss_anova_fcast(x0, gsa_);
-        hfig=dyn_figure(options_.nodisplay,'name',options_map.title);
+        hh_fig=dyn_figure(options_.nodisplay,'name',options_map.title);
         plot(y0,[yf y0],'.'),
         title([namy,' vs ', namx,' pred'],'interpreter','none')
-        dyn_saveas(hfig,[fname '_pred'],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[fname '_pred'],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[fname '_pred'],options_map.title,[namy,' vs ', namx,' pred'])
 
     end
@@ -762,7 +762,7 @@ return
 
 function indmcf = redform_mcf(y0, x0, options_mcf, options_)
 
-hfig=dyn_figure(options_.nodisplay,'name',options_mcf.amcf_title);
+hh_fig=dyn_figure(options_.nodisplay,'name',options_mcf.amcf_title);
 
 [post_mean, post_median, post_var, hpd_interval, post_deciles, ...
  density] = posterior_moments(y0,1,0.9);
@@ -813,7 +813,7 @@ if ~isoctave
                'horizontalalignment','center');
 end
 
-dyn_saveas(hfig,[options_mcf.OutputDirectoryName filesep options_mcf.fname_,'_',options_mcf.amcf_name],options_.nodisplay,options_.graph_format);
+dyn_saveas(hh_fig,[options_mcf.OutputDirectoryName filesep options_mcf.fname_,'_',options_mcf.amcf_name],options_.nodisplay,options_.graph_format);
 create_TeX_loader(options_,[options_mcf.OutputDirectoryName filesep options_mcf.fname_,'_',options_mcf.amcf_name],strrep(options_mcf.amcf_title,'_','\_'),[options_mcf.fname_,'_',options_mcf.amcf_name])
 
 return
diff --git a/matlab/gsa/redform_screen.m b/matlab/gsa/redform_screen.m
index 704923f9c5..c7cb31d4b0 100644
--- a/matlab/gsa/redform_screen.m
+++ b/matlab/gsa/redform_screen.m
@@ -11,7 +11,7 @@ function redform_screen(dirname, options_gsa_)
 % marco.ratto@ec.europa.eu
 
 % Copyright © 2012-2016 European Commission
-% Copyright © 2012-2018 Dynare Team
+% Copyright © 2012-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -66,7 +66,7 @@ for j=1:size(anamendo,1)
             if ~isempty(y0)
                 if mod(iplo,9)==0
                     ifig = ifig+1;
-                    hh = dyn_figure(options_.nodisplay, 'name', [namendo,[' vs. shocks '], int2str(ifig)]);
+                    hh_fig = dyn_figure(options_.nodisplay, 'name', [namendo,[' vs. shocks '], int2str(ifig)]);
                     iplo = 0;
                 end
                 iplo = iplo+1;
@@ -84,7 +84,7 @@ for j=1:size(anamendo,1)
                 end
                 title([namendo,' vs. ',namexo],'interpreter','none')
                 if iplo==9
-                    dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],options_.nodisplay,options_.graph_format);
                     create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],ifig,[namendo,' vs. shocks ',int2str(ifig)],[namendo,'_vs_shock'],1)
                 end
 
@@ -92,7 +92,7 @@ for j=1:size(anamendo,1)
         end
     end
     if iplo<9 && iplo>0 && ifig
-        dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shocks_',num2str(ifig)],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,'/',M_.fname,'_', namendo,'_vs_shocks_',num2str(ifig)],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],ifig,[namendo,' vs. shocks ',int2str(ifig)],[namendo,'_vs_shock'],options_.figures.textwidth*min(iplo/3))
     end
 
@@ -107,7 +107,7 @@ for j=1:size(anamendo,1)
             if ~isempty(y0)
                 if mod(iplo,9)==0
                     ifig=ifig+1;
-                    hh=dyn_figure(options_.nodisplay,'name',[namendo,' vs. lagged endogenous ',int2str(ifig)]);
+                    hh_fig=dyn_figure(options_.nodisplay,'name',[namendo,' vs. lagged endogenous ',int2str(ifig)]);
                     iplo=0;
                 end
                 iplo=iplo+1;
@@ -127,19 +127,19 @@ for j=1:size(anamendo,1)
 
                 title([namendo,' vs. ',namlagendo,'(-1)'],'interpreter','none')
                 if iplo==9
-                    dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_.nodisplay,options_.graph_format);
                     create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],ifig,[namendo,' vs. lagged endogenous ',int2str(ifig)],[namendo,'_vs_lags'],1)
                 end
             end
         end
     end
     if iplo<9 && iplo>0 && ifig
-        dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_.nodisplay,options_.graph_format);
         create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],ifig,[namendo,' vs. lagged endogenous ',int2str(ifig)],[namendo,'_vs_lags'],options_.figures.textwidth*min(iplo/3))
     end
 end
 
-hh=dyn_figure(options_.nodisplay,'Name','Reduced form screening');
+hh_fig=dyn_figure(options_.nodisplay,'Name','Reduced form screening');
 %bar(SA)
 % boxplot(SA','whis',10,'symbol','r.')
 myboxplot(SA',[],'.',[],10)
@@ -153,7 +153,7 @@ end
 xlabel(' ')
 ylabel('Elementary Effects')
 title('Reduced form screening')
-dyn_saveas(hh,[dirname,'/',M_.fname,'_redform_screen'],options_.nodisplay,options_.graph_format);
+dyn_saveas(hh_fig,[dirname,'/',M_.fname,'_redform_screen'],options_.nodisplay,options_.graph_format);
 create_TeX_loader(options_,[dirname,'/',M_.fname,'_redform_screen'],1,'Reduced form screening','redform_screen',1)
 
 
diff --git a/matlab/gsa/scatter_mcf.m b/matlab/gsa/scatter_mcf.m
index 8aaa96d858..d0c3439485 100644
--- a/matlab/gsa/scatter_mcf.m
+++ b/matlab/gsa/scatter_mcf.m
@@ -5,7 +5,7 @@ function  scatter_mcf(X,Y,vnames,plotsymbol, fnam, dirname, figtitle, xparam1, D
 % marco.ratto@ec.europa.eu
 
 % Copyright © 2014-2016 European Commission
-% Copyright © 2014-2017 Dynare Team
+% Copyright © 2014-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -84,7 +84,7 @@ figtitle_tex=strrep(figtitle,'_','\_');
 
 fig_nam_=[fnam];
 if ~nograph
-    hh=dyn_figure(DynareOptions.nodisplay,'name',figtitle);
+    hh_fig=dyn_figure(DynareOptions.nodisplay,'name',figtitle);
 end
 
 bf = 0.1;
@@ -166,7 +166,7 @@ if ~isoctave
 end
 
 if ~nograph
-    dyn_saveas(hh,[dirname,filesep,fig_nam_],DynareOptions.nodisplay,DynareOptions.graph_format);
+    dyn_saveas(hh_fig,[dirname,filesep,fig_nam_],DynareOptions.nodisplay,DynareOptions.graph_format);
     if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
         fidTeX = fopen([dirname,'/',fig_nam_ '.tex'],'w');
         fprintf(fidTeX,'%% TeX eps-loader file generated by scatter_mcf.m (Dynare).\n');
diff --git a/matlab/gsa/scatter_plots.m b/matlab/gsa/scatter_plots.m
index 9fbcf2f261..2a0d989aae 100644
--- a/matlab/gsa/scatter_plots.m
+++ b/matlab/gsa/scatter_plots.m
@@ -6,7 +6,7 @@ function scatter_plots(X,xp,vnames,plotsymbol, fnam, dirname, figtitle, xparam1,
 %
 
 % Copyright © 2017 European Commission
-% Copyright © 2017 Dynare Team
+% Copyright © 2017-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -73,8 +73,8 @@ figtitle_tex=strrep(figtitle,'_','\_');
 
 fig_nam_=[fnam];
 
-hh=dyn_figure(DynareOptions.nodisplay,'name',figtitle);
-set(hh,'userdata',{X,xp})
+hh_fig=dyn_figure(DynareOptions.nodisplay,'name',figtitle);
+set(hh_fig,'userdata',{X,xp})
 
 bf = 0.1;
 ffs = 0.05/(p-1);
@@ -172,7 +172,7 @@ end
 % end
 
 if ~nograph
-    dyn_saveas(hh,[dirname,filesep,fig_nam_],DynareOptions.nodisplay,DynareOptions.graph_format);
+    dyn_saveas(hh_fig,[dirname,filesep,fig_nam_],DynareOptions.nodisplay,DynareOptions.graph_format);
     if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
         fidTeX = fopen([dirname,'/',fig_nam_ '.tex'],'w');
         fprintf(fidTeX,'%% TeX eps-loader file generated by scatter_plots.m (Dynare).\n');
diff --git a/matlab/gsa/stab_map_1.m b/matlab/gsa/stab_map_1.m
index 7b47bc2f0b..f1ba4422f9 100644
--- a/matlab/gsa/stab_map_1.m
+++ b/matlab/gsa/stab_map_1.m
@@ -21,7 +21,7 @@ function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, i
 % marco.ratto@ec.europa.eu
 
 % Copyright © 2012-2016 European Commission
-% Copyright © 2012-2017 Dynare Team
+% Copyright © 2012-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -82,7 +82,7 @@ if iplot && ~options_.nograph
     ftit=bayestopt_.name(ipar+nshock*(1-ishock));
 
     for i=1:ceil(nparplot/12)
-        hh=dyn_figure(options_.nodisplay,'name',atitle);
+        hh_fig=dyn_figure(options_.nodisplay,'name',atitle);
         for j=1+12*(i-1):min(nparplot,12*i)
             subplot(3,4,j-12*(i-1))
             if ~isempty(ibehaviour)
@@ -98,7 +98,7 @@ if iplot && ~options_.nograph
             title([ftit{j},'. p-value ', num2str(proba(ipar(j)),2)],'interpreter','none')
         end
         if nparplot>12
-            dyn_saveas(hh,[dirname,filesep,fname_,'_',aname,'_SA_',int2str(i)],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[dirname,filesep,fname_,'_',aname,'_SA_',int2str(i)],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fidTeX = fopen([dirname,filesep,fname_,'_',aname,'_SA_',int2str(i) '.tex'],'w');
                 fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_1.m (Dynare).\n');
@@ -113,7 +113,7 @@ if iplot && ~options_.nograph
                 fclose(fidTeX);
             end
         else
-            dyn_saveas(hh,[dirname,filesep,fname_,'_',aname,'_SA'],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[dirname,filesep,fname_,'_',aname,'_SA'],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fidTeX = fopen([dirname,filesep,fname_,'_',aname,'_SA.tex'],'w');
                 fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_1.m (Dynare).\n');
diff --git a/matlab/gsa/stab_map_2.m b/matlab/gsa/stab_map_2.m
index 3e6e508c18..50a33603f6 100644
--- a/matlab/gsa/stab_map_2.m
+++ b/matlab/gsa/stab_map_2.m
@@ -6,7 +6,7 @@ function indcorr = stab_map_2(x,alpha2, pvalue_crit, fnam, dirname,xparam1,figti
 % marco.ratto@ec.europa.eu
 
 % Copyright © 2011-2016 European Commission
-% Copyright © 2011-2018 Dynare Team
+% Copyright © 2011-2023 Dynare Team
 % This file is part of Dynare.
 %
 % Dynare is free software: you can redistribute it and/or modify
@@ -118,7 +118,7 @@ for j=1:npar
                 if ~nograph
                     if mod(j2,12)==1
                         ifig=ifig+1;
-                        hh=dyn_figure(options_.nodisplay,'name',[figtitle,' sample bivariate projection ', num2str(ifig)]);
+                        hh_fig=dyn_figure(options_.nodisplay,'name',[figtitle,' sample bivariate projection ', num2str(ifig)]);
                     end
                     subplot(3,4,j2-(ifig-1)*12)
                     %             bar(c0(i2,j)),
@@ -141,7 +141,7 @@ for j=1:npar
                     end
                     title(['cc = ',num2str(c0(i2(jx),j))])
                     if (mod(j2,12)==0) && j2>0
-                        dyn_saveas(hh,[dirname,filesep,fig_nam_,int2str(ifig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[dirname,filesep,fig_nam_,int2str(ifig)],options_.nodisplay,options_.graph_format);
                         if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                             fidTeX = fopen([dirname,filesep,fig_nam_,int2str(ifig),'.tex'],'w');
                             fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_2.m (Dynare).\n');
@@ -162,7 +162,7 @@ for j=1:npar
         end
     end
     if ~nograph && (j==(npar)) && j2>0 && (mod(j2,12)~=0)
-        dyn_saveas(hh,[dirname,filesep,fig_nam_,int2str(ifig)],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[dirname,filesep,fig_nam_,int2str(ifig)],options_.nodisplay,options_.graph_format);
         if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
             fidTeX = fopen([dirname,filesep,fig_nam_,int2str(ifig),'.tex'],'w');
             fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_2.m (Dynare).\n');
diff --git a/matlab/mh_autocorrelation_function.m b/matlab/mh_autocorrelation_function.m
index 97295b1c75..565c16504c 100644
--- a/matlab/mh_autocorrelation_function.m
+++ b/matlab/mh_autocorrelation_function.m
@@ -93,7 +93,7 @@ if options_.mh_nblck>1
     FigureName = [ FigureName , ' (block number' int2str(blck)  ').'];
 end
 
-hh=dyn_figure(options_.nodisplay,'Name',FigureName);
+hh_fig=dyn_figure(options_.nodisplay,'Name',FigureName);
 
 bar(0:options_.mh_autocorrelation_function_size,autocor,'k');
 axis tight
@@ -106,4 +106,4 @@ if ~exist([M_.dname filesep 'graphs'])
 end
 
 plot_name=get_the_name(column,0,M_,estim_params_,options_);
-dyn_saveas(hh,[M_.dname, filesep, 'graphs', filesep, 'MH_Autocorrelation_' plot_name],options_.nodisplay,options_.graph_format)
+dyn_saveas(hh_fig,[M_.dname, filesep, 'graphs', filesep, 'MH_Autocorrelation_' plot_name],options_.nodisplay,options_.graph_format)
diff --git a/matlab/missing_DiffuseKalmanSmootherH3_Z.m b/matlab/missing_DiffuseKalmanSmootherH3_Z.m
index a5894922aa..d863db5a38 100644
--- a/matlab/missing_DiffuseKalmanSmootherH3_Z.m
+++ b/matlab/missing_DiffuseKalmanSmootherH3_Z.m
@@ -64,7 +64,7 @@ function [alphahat,epsilonhat,etahat,a,P1,aK,PK,decomp,V, aalphahat,eetahat,d,al
 %   Models", S.J. Koopman and J. Durbin (2003), in Journal of Time Series
 %   Analysis, vol. 24(1), pp. 85-98.
 
-% Copyright © 2004-2021 Dynare Team
+% Copyright © 2004-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -315,8 +315,8 @@ if isoccbin
         % kalman update is not yet robust to accommodate diffuse steps
     end
     if occbin_options.opts_regime.waitbar
-        hh = dyn_waitbar(0,'Occbin: Piecewise Kalman Filter');
-        set(hh,'Name','Occbin: Piecewise Kalman Filter.');
+        hh_fig = dyn_waitbar(0,'Occbin: Piecewise Kalman Filter');
+        set(hh_fig,'Name','Occbin: Piecewise Kalman Filter.');
         waitbar_indicator=1;
     else
         waitbar_indicator=0;
@@ -346,7 +346,7 @@ while notsteady && t<smpl
     di = data_index{t}';
     if t>=first_period_occbin_update
         if waitbar_indicator
-            dyn_waitbar(t/smpl, hh, sprintf('Period %u of %u', t,smpl));
+            dyn_waitbar(t/smpl, hh_fig, sprintf('Period %u of %u', t,smpl));
         end
         occbin_options.opts_regime.waitbar=0;
         if t==1
@@ -530,7 +530,7 @@ while notsteady && t<smpl
     end
 end
 if waitbar_indicator
-    dyn_waitbar_close(hh);
+    dyn_waitbar_close(hh_fig);
 end
 
 P1(:,:,t+1) = P(:,:,t+1);
diff --git a/matlab/nonlinear-filters/online_auxiliary_filter.m b/matlab/nonlinear-filters/online_auxiliary_filter.m
index bbfb21e3e5..f81469e6c0 100644
--- a/matlab/nonlinear-filters/online_auxiliary_filter.m
+++ b/matlab/nonlinear-filters/online_auxiliary_filter.m
@@ -21,7 +21,7 @@ function [pmean, pmode, pmedian, pstdev, p025, p975, covariance] = online_auxili
 % - p975                     [double]    n×1 vector, 97.5 percent of the particles are below p975(i) for i=1,…,n.
 % - covariance               [double]    n×n matrix, covariance of the particles at the end of the sample.
 
-% Copyright © 2013-2022 Dynare Team
+% Copyright © 2013-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -386,7 +386,7 @@ if TeX
 end
 
 for plt = 1:nbplt
-    hh = dyn_figure(DynareOptions.nodisplay,'Name','Parameters Trajectories');
+    hh_fig = dyn_figure(DynareOptions.nodisplay,'Name','Parameters Trajectories');
     for k=1:length(pmean)
         subplot(nr,nc,k)
         [name,texname] = get_the_name(k,TeX,Model,EstimatedParameters,DynareOptions);
@@ -405,7 +405,7 @@ for plt = 1:nbplt
         axis tight
         drawnow
     end
-    dyn_saveas(hh, [Model.fname '_param_traj' int2str(plt)], DynareOptions.nodisplay, DynareOptions.graph_format);
+    dyn_saveas(hh_fig, [Model.fname '_param_traj' int2str(plt)], DynareOptions.nodisplay, DynareOptions.graph_format);
     if TeX
         % TeX eps loader file
         fprintf(fidTeX,'\\begin{figure}[H]\n');
@@ -423,7 +423,7 @@ number_of_grid_points = 2^9;      % 2^9 = 512 !... Must be a power of two.
 bandwidth = 0;                    % Rule of thumb optimal bandwidth parameter.
 kernel_function = 'gaussian';     % Gaussian kernel for Fast Fourier Transform approximation.
 for plt = 1:nbplt
-    hh = dyn_figure(DynareOptions.nodisplay,'Name','Parameters Densities');
+    hh_fig = dyn_figure(DynareOptions.nodisplay,'Name','Parameters Densities');
     for k=1:length(pmean)
         subplot(nr,nc,k)
         [name,texname] = get_the_name(k,TeX,Model,EstimatedParameters,DynareOptions);
@@ -441,7 +441,7 @@ for plt = 1:nbplt
         axis tight
         drawnow
     end
-    dyn_saveas(hh,[ Model.fname '_param_density' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
+    dyn_saveas(hh_fig,[ Model.fname '_param_density' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
     if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
         % TeX eps loader file
         fprintf(fidTeX, '\\begin{figure}[H]\n');
diff --git a/matlab/olsgibbs.m b/matlab/olsgibbs.m
index 66fce0ea87..6d1590cb70 100644
--- a/matlab/olsgibbs.m
+++ b/matlab/olsgibbs.m
@@ -30,7 +30,7 @@ function ds = olsgibbs(ds, eqtag, BetaPriorExpectation, BetaPriorVariance, s2, n
 % SPECIAL REQUIREMENTS
 %   dynare must have been run with the option: json=compute
 
-% Copyright © 2018-2021 Dynare Team
+% Copyright © 2018-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -183,11 +183,11 @@ for i=1:discarddraws
     h = gamrnd(PosteriorDegreesOfFreedom/2.0, 2.0/(PosteriorDegreesOfFreedom*s2_));
 end
 
-hh = dyn_waitbar(0,'Please wait. Gibbs sampler...');
-set(hh,'Name','Olsgibbs estimation.');
+hh_fig = dyn_waitbar(0,'Please wait. Gibbs sampler...');
+set(hh_fig,'Name','Olsgibbs estimation.');
 for i = discarddraws+1:ndraws
     if ~mod(i,10)
-        dyn_waitbar((i-discarddraws)/(ndraws-discarddraws),hh,'Please wait. Gibbs sampler...');
+        dyn_waitbar((i-discarddraws)/(ndraws-discarddraws),hh_fig,'Please wait. Gibbs sampler...');
     end
     % Set conditional distribution of β
     InverseConditionalPoseriorVariance = BetaInversePriorVariance + h*(X'*X);
@@ -211,7 +211,7 @@ for i = discarddraws+1:ndraws
         periods = periods+1;
     end
 end
-dyn_waitbar_close(hh);
+dyn_waitbar_close(hh_fig);
 
 %% Save posterior moments.
 oo_.olsgibbs.(model_name).posterior.mean.beta = mean(oo_.olsgibbs.(model_name).draws(:,1:n))';
diff --git a/matlab/optimization/gmhmaxlik_core.m b/matlab/optimization/gmhmaxlik_core.m
index 805516f1d1..c75a946eb7 100644
--- a/matlab/optimization/gmhmaxlik_core.m
+++ b/matlab/optimization/gmhmaxlik_core.m
@@ -56,7 +56,7 @@ function [PostMod,PostVar,Scale,PostMean] = gmhmaxlik_core(ObjFun,xparam1,mh_bou
 % SPECIAL REQUIREMENTS
 %   None.
 
-% Copyright © 2006-2017 Dynare Team
+% Copyright © 2006-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -87,8 +87,8 @@ CovJump = VarCov;
 ModePar = xparam1;
 
 %% [1] I tune the scale parameter.
-hh = dyn_waitbar(0,'Tuning of the scale parameter...');
-set(hh,'Name','Tuning of the scale parameter.');
+hh_fig = dyn_waitbar(0,'Tuning of the scale parameter...');
+set(hh_fig,'Name','Tuning of the scale parameter.');
 j = 1; jj  = 1;
 isux = 0; jsux = 0; test = 0;
 ix2 = ModePar;% initial condition!
@@ -119,7 +119,7 @@ while j<=MaxNumberOfTuningSimulations
     end % ... otherwise I don't move.
     prtfrc = j/MaxNumberOfTuningSimulations;
     if mod(j, 10)==0
-        dyn_waitbar(prtfrc,hh,sprintf('Acceptance ratio [during last 500]: %f [%f]',isux/j,jsux/jj));
+        dyn_waitbar(prtfrc,hh_fig,sprintf('Acceptance ratio [during last 500]: %f [%f]',isux/j,jsux/jj));
     end
     if  j/500 == round(j/500)
         test1 = jsux/jj;
@@ -141,10 +141,10 @@ while j<=MaxNumberOfTuningSimulations
     jj = jj + 1;
 end
 
-dyn_waitbar_close(hh);
+dyn_waitbar_close(hh_fig);
 %% [2] One block metropolis, I update the covariance matrix of the jumping distribution
-hh = dyn_waitbar(0,'Metropolis-Hastings...');
-set(hh,'Name','Estimation of the posterior covariance...'),
+hh_fig = dyn_waitbar(0,'Metropolis-Hastings...');
+set(hh_fig,'Name','Estimation of the posterior covariance...'),
 j = 1;
 isux = 0;
 ilogpo2 = - feval(ObjFun,ix2,varargin{:});
@@ -169,7 +169,7 @@ while j<= NumberOfIterations
     end % ... otherwise I don't move.
     prtfrc = j/NumberOfIterations;
     if mod(j, 10)==0
-        dyn_waitbar(prtfrc,hh,sprintf('Acceptance ratio: %f',isux/j));
+        dyn_waitbar(prtfrc,hh_fig,sprintf('Acceptance ratio: %f',isux/j));
     end
     % I update the covariance matrix and the mean:
     oldMeanPar = MeanPar;
@@ -177,7 +177,7 @@ while j<= NumberOfIterations
     CovJump = CovJump + oldMeanPar*oldMeanPar' - MeanPar*MeanPar' + ...
               (1/j)*(ix2*ix2' - CovJump - oldMeanPar*oldMeanPar');
 end
-dyn_waitbar_close(hh);
+dyn_waitbar_close(hh_fig);
 PostVar = CovJump;
 PostMean = MeanPar;
 %% [3 & 4] I tune the scale parameter (with the new covariance matrix) if
@@ -185,8 +185,8 @@ PostMean = MeanPar;
 %% updating the covariance matrix)...
 if strcmpi(info,'LastCall')
 
-    hh = dyn_waitbar(0,'Tuning of the scale parameter...');
-    set(hh,'Name','Tuning of the scale parameter.'),
+    hh_fig = dyn_waitbar(0,'Tuning of the scale parameter...');
+    set(hh_fig,'Name','Tuning of the scale parameter.'),
     j = 1; jj  = 1;
     isux = 0; jsux = 0;
     test = 0;
@@ -212,7 +212,7 @@ if strcmpi(info,'LastCall')
         end % ... otherwise I don't move.
         prtfrc = j/MaxNumberOfTuningSimulations;
         if mod(j, 10)==0
-            dyn_waitbar(prtfrc,hh,sprintf('Acceptance ratio [during last 1000]: %f [%f]',isux/j,jsux/jj));
+            dyn_waitbar(prtfrc,hh_fig,sprintf('Acceptance ratio [during last 1000]: %f [%f]',isux/j,jsux/jj));
         end
         if j/1000 == round(j/1000)
             test1 = jsux/jj;
@@ -229,14 +229,14 @@ if strcmpi(info,'LastCall')
         j = j+1;
         jj = jj + 1;
     end
-    dyn_waitbar_close(hh);
+    dyn_waitbar_close(hh_fig);
     Scale = iScale;
     %%
     %% Now I climb the hill
     %%
     if options.nclimb
-        hh = dyn_waitbar(0,' ');
-        set(hh,'Name','Now I am climbing the hill...'),
+        hh_fig = dyn_waitbar(0,' ');
+        set(hh_fig,'Name','Now I am climbing the hill...'),
         j = 1; jj  = 1;
         jsux = 0;
         test = 0;
@@ -254,7 +254,7 @@ if strcmpi(info,'LastCall')
             end % otherwise I don't move...
             prtfrc = j/MaxNumberOfClimbingSimulations;
             if mod(j, 10)==0
-                dyn_waitbar(prtfrc,hh,sprintf('%f Jumps / MaxStepSize %f',jsux,sqrt(max(diag(iScale*CovJump)))));
+                dyn_waitbar(prtfrc,hh_fig,sprintf('%f Jumps / MaxStepSize %f',jsux,sqrt(max(diag(iScale*CovJump)))));
             end
             if  j/200 == round(j/200)
                 if jsux<=1
@@ -275,7 +275,7 @@ if strcmpi(info,'LastCall')
             j = j+1;
             jj = jj + 1;
         end
-        dyn_waitbar_close(hh);
+        dyn_waitbar_close(hh_fig);
     end %climb
 else
     Scale = iScale;
diff --git a/matlab/plot_icforecast.m b/matlab/plot_icforecast.m
index 547272a7f3..da4d88ebbd 100644
--- a/matlab/plot_icforecast.m
+++ b/matlab/plot_icforecast.m
@@ -13,7 +13,7 @@ function plot_icforecast(Variables,periods,options_,oo_)
 % SPECIAL REQUIREMENTS
 %  This routine has to be called after imcforecast.m.
 
-% Copyright © 2006-2019 Dynare Team
+% Copyright © 2006-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -59,7 +59,7 @@ for i=1:length(Variables)
 end
 
 function build_figure(name,cci1,cci2,mm1,mm2,options_,graphoptions)
-hh = dyn_figure(options_.nodisplay,'Name',['Conditional forecast (' graphoptions.title ,'): ' name '.']);
+hh_fig = dyn_figure(options_.nodisplay,'Name',['Conditional forecast (' graphoptions.title ,'): ' name '.']);
 H = length(mm1);
 h1 = area(1:H,cci1(2,1:H),'BaseValue',min([min(cci1(1,:)),min(cci2(1,:))]),'FaceColor',[.9 .9 .9]);
 hold on
@@ -70,4 +70,4 @@ plot(1:H,cci2(1,:),'--k','linewidth',1)
 plot(1:H,cci2(2,:),'--k','linewidth',1)
 axis tight
 hold off
-dyn_saveas(hh,[graphoptions.OutputDirectoryName '/Conditional_forecast_',strrep(deblank(graphoptions.title),' ','_'),'_',name],options_.nodisplay,options_.graph_format)
\ No newline at end of file
+dyn_saveas(hh_fig,[graphoptions.OutputDirectoryName '/Conditional_forecast_',strrep(deblank(graphoptions.title),' ','_'),'_',name],options_.nodisplay,options_.graph_format)
\ No newline at end of file
diff --git a/matlab/plot_identification.m b/matlab/plot_identification.m
index 2d9e5a3ef3..688f177a98 100644
--- a/matlab/plot_identification.m
+++ b/matlab/plot_identification.m
@@ -19,7 +19,7 @@ function plot_identification(params, idemoments, idehess, idemodel, idelre, adva
 % SPECIAL REQUIREMENTS
 %    None
 
-% Copyright © 2008-2021 Dynare Team
+% Copyright © 2008-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -55,7 +55,7 @@ tittxt1=regexprep(tittxt, ' ', '_');
 tittxt1=strrep(tittxt1, '.', '');
 if SampleSize == 1
     si_dMOMENTS = idemoments.si_dMOMENTS;
-    hh = dyn_figure(options_.nodisplay,'Name',[tittxt, ' - Identification using info from observables']);
+    hh_fig = dyn_figure(options_.nodisplay,'Name',[tittxt, ' - Identification using info from observables']);
     subplot(211)
     mmm = (idehess.ide_strength_dMOMENTS);
     [ss, is] = sort(mmm);
@@ -156,7 +156,7 @@ if SampleSize == 1
         fprintf(fidTeX,'%% End Of TeX file. \n');
         fclose(fidTeX);
     end
-    dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_ident_strength_' tittxt1],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[IdentifDirectoryName '/' M_.fname '_ident_strength_' tittxt1],options_.nodisplay,options_.graph_format);
 
     if advanced
         if ~options_.nodisplay
@@ -166,7 +166,7 @@ if SampleSize == 1
         if all(isnan([si_dMOMENTSnorm';si_dTAUnorm';si_dLREnorm']))
             fprintf('\nIDENTIFICATION: Skipping sensitivity plot, because standard deviation of parameters is NaN, possibly due to the use of ML.\n')
         else
-            hh = dyn_figure(options_.nodisplay,'Name',[tittxt, ' - Sensitivity plot']);
+            hh_fig = dyn_figure(options_.nodisplay,'Name',[tittxt, ' - Sensitivity plot']);
             subplot(211)
             mmm = (si_dMOMENTSnorm)'./max(si_dMOMENTSnorm);
             mmm1 = (si_dTAUnorm)'./max(si_dTAUnorm);
@@ -185,7 +185,7 @@ if SampleSize == 1
             end
             legend('Moments','Model','LRE model','Location','Best')
             title('Sensitivity bars using derivatives (log-scale)')
-            dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_sensitivity_' tittxt1 ],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[IdentifDirectoryName '/' M_.fname '_sensitivity_' tittxt1 ],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fidTeX = fopen([IdentifDirectoryName '/' M_.fname '_sensitivity_' tittxt1,'.tex'],'w');
                 fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -219,7 +219,7 @@ if SampleSize == 1
                 end
                 %                 fprintf('%-15s [%s] %10.3f\n',name{i},namx,idemoments.cosndMOMENTS(i,j))
             end
-            hh = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)']);
+            hh_fig = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)']);
             imagesc(pax,[0 1]);
             set(gca,'xticklabel','')
             set(gca,'yticklabel','')
@@ -239,7 +239,7 @@ if SampleSize == 1
             set(gca,'xgrid','on')
             set(gca,'ygrid','on')
             xlabel([tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)'],'interpreter','none')
-            dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_.nodisplay,options_.graph_format);
+            dyn_saveas(hh_fig,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_.nodisplay,options_.graph_format);
             if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                 fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j),'.tex'],'w');
                 fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -337,7 +337,7 @@ if SampleSize == 1
     end
 
 else
-    hh = dyn_figure(options_.nodisplay,'Name',['MC sensitivities']);
+    hh_fig = dyn_figure(options_.nodisplay,'Name',['MC sensitivities']);
     subplot(211)
     mmm = (idehess.ide_strength_dMOMENTS);
     [ss, is] = sort(mmm);
@@ -363,7 +363,7 @@ else
         legend('Moments','Model','LRE model','Location','Best')
     end
     title('MC mean of sensitivity measures')
-    dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_MC_sensitivity' ],options_.nodisplay,options_.graph_format);
+    dyn_saveas(hh_fig,[ IdentifDirectoryName '/' M_.fname '_MC_sensitivity' ],options_.nodisplay,options_.graph_format);
     if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
         fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_MC_sensitivity.tex'],'w');
         fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -384,7 +384,7 @@ else
             disp('Displaying advanced diagnostics')
         end
         %         options_.nograph=1;
-        hh = dyn_figure(options_.nodisplay,'Name','MC Condition Number');
+        hh_fig = dyn_figure(options_.nodisplay,'Name','MC Condition Number');
         subplot(221)
         hist(log10(idemodel.cond))
         title('log10 of Condition number in the model')
@@ -394,7 +394,7 @@ else
         subplot(223)
         hist(log10(idelre.cond))
         title('log10 of Condition number in the LRE model')
-        dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_ident_COND' ],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[IdentifDirectoryName '/' M_.fname '_ident_COND' ],options_.nodisplay,options_.graph_format);
         options_mcf.pvalue_ks = 0.1;
         options_mcf.pvalue_corr = 0.001;
         options_mcf.alpha2 = 0;
diff --git a/matlab/pm3_core.m b/matlab/pm3_core.m
index 0d6ef4991e..343c708975 100644
--- a/matlab/pm3_core.m
+++ b/matlab/pm3_core.m
@@ -13,7 +13,7 @@ function myoutput=pm3_core(myinputs,fpar,nvar,whoiam, ThisMatlab)
 % SPECIAL REQUIREMENTS.
 %   None.
 
-% Copyright © 2007-2018 Dynare Team
+% Copyright © 2007-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -68,7 +68,7 @@ end
 
 figunumber = 0;
 subplotnum = 0;
-hh = dyn_figure(options_.nodisplay,'Name',[tit1 ' ' int2str(figunumber+1)]);
+hh_fig = dyn_figure(options_.nodisplay,'Name',[tit1 ' ' int2str(figunumber+1)]);
 RemoteFlag = 0;
 if whoiam
     if Parallel(ThisMatlab).Local ==0
@@ -81,7 +81,7 @@ OutputFileName = {};
 for i=fpar:nvar
     if max(abs(Mean(:,i))) > 10^(-6)
         subplotnum = subplotnum+1;
-        set(0,'CurrentFigure',hh);
+        set(0,'CurrentFigure',hh_fig);
         subplot(nn,nn,subplotnum);
         if ~(all(all(Distrib(:,:,i)))>0 || ~all(all(Distrib(:,:,i)))<0)
             plot([1 n2],[0 0],'-r','linewidth',0.5);
@@ -115,14 +115,14 @@ for i=fpar:nvar
     end
 
     if subplotnum == MaxNumberOfPlotsPerFigure || i == nvar
-        dyn_saveas(hh,[M_.dname '/Output/'  M_.fname '_' name3 '_' tit3{i}],options_.nodisplay,options_.graph_format);
+        dyn_saveas(hh_fig,[M_.dname '/Output/'  M_.fname '_' name3 '_' tit3{i}],options_.nodisplay,options_.graph_format);
         if RemoteFlag==1
             OutputFileName = [OutputFileName; {[M_.dname, filesep, 'Output',filesep], [M_.fname '_' name3 '_' deblank(tit3(i,:)) '.*']}];
         end
         subplotnum = 0;
         figunumber = figunumber+1;
         if (i ~= nvar)
-            hh = dyn_figure(options_.nodisplay,'Name',[name3 ' ' int2str(figunumber+1)]);
+            hh_fig = dyn_figure(options_.nodisplay,'Name',[name3 ' ' int2str(figunumber+1)]);
         end
     end
 
diff --git a/matlab/posterior_sampler_core.m b/matlab/posterior_sampler_core.m
index 0722858c4c..4e3379a644 100644
--- a/matlab/posterior_sampler_core.m
+++ b/matlab/posterior_sampler_core.m
@@ -174,12 +174,12 @@ for curr_block = fblck:nblck
         refresh_rate = sampler_options.parallel_bar_refresh_rate;
         bar_title = sampler_options.parallel_bar_title;
         prc0=(curr_block-fblck)/(nblck-fblck+1)*(isoctave || options_.console_mode);
-        hh = dyn_waitbar({prc0,whoiam,options_.parallel(ThisMatlab)},[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ')...']);
+        hh_fig = dyn_waitbar({prc0,whoiam,options_.parallel(ThisMatlab)},[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ')...']);
     else
         refresh_rate = sampler_options.serial_bar_refresh_rate;
         bar_title = sampler_options.serial_bar_title;
-        hh = dyn_waitbar(0,[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ')...']);
-        set(hh,'Name',bar_title);
+        hh_fig = dyn_waitbar(0,[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ')...']);
+        set(hh_fig,'Name',bar_title);
     end
     if mh_recover_flag==0
         accepted_draws_this_chain = 0;
@@ -207,9 +207,9 @@ for curr_block = fblck:nblck
         prtfrc = draw_iter/nruns(curr_block);
         if mod(draw_iter, refresh_rate)==0
             if accepted_draws_this_chain/draw_iter==1 && sum(neval)>1
-                dyn_waitbar(prtfrc,hh,[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ') ' sprintf('Function eval per draw %4.3f', feval_this_chain/draw_iter)]);
+                dyn_waitbar(prtfrc,hh_fig,[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ') ' sprintf('Function eval per draw %4.3f', feval_this_chain/draw_iter)]);
             else
-                dyn_waitbar(prtfrc,hh,[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ') ' sprintf('Current acceptance ratio %4.3f', accepted_draws_this_chain/draw_iter)]);
+                dyn_waitbar(prtfrc,hh_fig,[bar_title ' (' int2str(curr_block) '/' int2str(options_.mh_nblck) ') ' sprintf('Current acceptance ratio %4.3f', accepted_draws_this_chain/draw_iter)]);
             end
             if save_tmp_file
                 [LastSeeds.(['file' int2str(NewFile(curr_block))]).Unifor, LastSeeds.(['file' int2str(NewFile(curr_block))]).Normal] = get_dynare_random_generator_state();
@@ -265,7 +265,7 @@ for curr_block = fblck:nblck
         draw_iter=draw_iter+1;
         draw_index_current_file = draw_index_current_file + 1;
     end % End of the simulations for one mh-block.
-    dyn_waitbar_close(hh);
+    dyn_waitbar_close(hh_fig);
     if nruns(curr_block)
         record.AcceptanceRatio(curr_block) = accepted_draws_this_chain/(draw_iter-1);
         record.FunctionEvalPerIteration(curr_block) = feval_this_chain/(draw_iter-1);
diff --git a/matlab/prior_sampler.m b/matlab/prior_sampler.m
index 1303cbcf02..3ef74fd45b 100644
--- a/matlab/prior_sampler.m
+++ b/matlab/prior_sampler.m
@@ -85,13 +85,13 @@ file_indx_number = 0;
 
 oo_.dr=set_state_space(oo_.dr,M_,options_);
 
-hh = dyn_waitbar(0,'Please wait. Prior sampler...');
-set(hh,'Name','Prior sampler.');
+hh_fig = dyn_waitbar(0,'Please wait. Prior sampler...');
+set(hh_fig,'Name','Prior sampler.');
 
 % Simulations.
 while iteration < NumberOfSimulations
     if ~mod(iteration,10)
-        dyn_waitbar(iteration/NumberOfSimulations,hh,'Please wait. Prior sampler...');
+        dyn_waitbar(iteration/NumberOfSimulations,hh_fig,'Please wait. Prior sampler...');
     end
     loop_indx = loop_indx+1;
     params = Prior.draw();
@@ -162,7 +162,7 @@ while iteration < NumberOfSimulations
     end
 end
 
-dyn_waitbar_close(hh);
+dyn_waitbar_close(hh_fig);
 
 % Get informations about BK conditions and other things...
 results.bk.indeterminacy_share = count_bk_indeterminacy/loop_indx;
diff --git a/matlab/rplot.m b/matlab/rplot.m
index 6c54fc8791..53abb116de 100644
--- a/matlab/rplot.m
+++ b/matlab/rplot.m
@@ -14,7 +14,7 @@ function rplot(s1)
 % SPECIAL REQUIREMENTS
 %    none
 
-% Copyright © 2001-2021 Dynare Team
+% Copyright © 2001-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -75,7 +75,7 @@ if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
 end
 
 if options_.rplottype == 0 %all in one plot
-    hh=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory');
+    hh_fig=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory');
     plot(ix(i),y(:,i)) ;
     if options_.TeX
         title (['Plot of $' strjoin(s1_TeX', '~') '$'],'Interpreter','latex') ;
@@ -94,13 +94,13 @@ if options_.rplottype == 0 %all in one plot
             legend(s1,'interpreter','none');
         end
     end
-    dyn_saveas(hh,[M_.dname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{1}],options_.nodisplay,options_.graph_format)
+    dyn_saveas(hh_fig,[M_.dname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{1}],options_.nodisplay,options_.graph_format)
     if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
         create_TeX_loader(fidTeX,[M_.dname, '/graphs/', 'SimulatedTrajectory_' s1{1}],'Simulated trajectories','SimulatedTrajectory_',s1{1},1)
     end
 elseif options_.rplottype == 1 %separate figures each
     for j = 1:size(y,1)
-        hh=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory');
+        hh_fig=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory');
         plot(ix(i),y(j,i)) ;
         xlim([min(ix(i)) max(ix(i))])
         if options_.TeX
@@ -109,13 +109,13 @@ elseif options_.rplottype == 1 %separate figures each
             title(['Plot of ' s1{j}],'Interpreter','none') ;
         end
         xlabel('Periods') ;
-        dyn_saveas(hh,[M_.dname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{j}],options_.nodisplay,options_.graph_format)
+        dyn_saveas(hh_fig,[M_.dname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{j}],options_.nodisplay,options_.graph_format)
         if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
             create_TeX_loader(fidTeX,[M_.dname, '/graphs/', 'SimulatedTrajectory_' s1{j}],'Simulated trajectories','SimulatedTrajectory_',s1{j},1);
         end
     end
 elseif options_.rplottype == 2 %different subplots
-    hh=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory');
+    hh_fig=dyn_figure(options_.nodisplay,'Name', 'Simulated Trajectory');
     nl = max(1,fix(size(y,1)/4)) ;
     nc = ceil(size(y,1)/nl) ;
     for j = 1:size(y,1)
@@ -137,7 +137,7 @@ elseif options_.rplottype == 2 %different subplots
         end
         axis tight;
     end
-    dyn_saveas(hh,[M_.dname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{1}],options_.nodisplay,options_.graph_format)
+    dyn_saveas(hh_fig,[M_.dname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' s1{1}],options_.nodisplay,options_.graph_format)
     if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
         create_TeX_loader(fidTeX,[M_.dname, '/graphs/', 'SimulatedTrajectory_' s1{1}],'Simulated trajectories','SimulatedTrajectory_', s1{1},min(j/nc,1));
     end
diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m
index 06a1f7eb47..0742ddc47a 100644
--- a/matlab/stoch_simul.m
+++ b/matlab/stoch_simul.m
@@ -310,10 +310,10 @@ if options_.irf
                 if nbplt == 0
                 elseif nbplt == 1
                     if options_.relative_irf
-                        hh = dyn_figure(options_.nodisplay,'Name',['Relative response to' ...
+                        hh_fig = dyn_figure(options_.nodisplay,'Name',['Relative response to' ...
                                             ' orthogonalized shock to ' tit{i}]);
                     else
-                        hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to' ...
+                        hh_fig = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to' ...
                                             ' ' tit{i}]);
                     end
                     for j = 1:number_of_plots_to_draw
@@ -330,7 +330,7 @@ if options_.irf
                             title(deblank(mylist(j,:)),'Interpreter','none');
                         end
                     end
-                    dyn_saveas(hh,[M_.dname, '/graphs/' M_.fname '_IRF_' tit{i}],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[M_.dname, '/graphs/' M_.fname '_IRF_' tit{i}],options_.nodisplay,options_.graph_format);
                     if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                         fprintf(fidTeX,'\\begin{figure}[H]\n');
                         fprintf(fidTeX,'\\centering \n');
@@ -343,10 +343,10 @@ if options_.irf
                 else
                     for fig = 1:nbplt-1
                         if options_.relative_irf
-                            hh = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock' ...
+                            hh_fig = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock' ...
                                                 ' to ' tit{i} ' figure ' int2str(fig)]);
                         else
-                            hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i} ...
+                            hh_fig = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i} ...
                                                 ' figure ' int2str(fig)]);
                         end
                         for plt = 1:nstar
@@ -363,7 +363,7 @@ if options_.irf
                                 title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none');
                             end
                         end
-                        dyn_saveas(hh,[M_.dname, '/graphs/'  M_.fname '_IRF_' tit{i} int2str(fig)],options_.nodisplay,options_.graph_format);
+                        dyn_saveas(hh_fig,[M_.dname, '/graphs/'  M_.fname '_IRF_' tit{i} int2str(fig)],options_.nodisplay,options_.graph_format);
                         if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                             fprintf(fidTeX,'\\begin{figure}[H]\n');
                             fprintf(fidTeX,'\\centering \n');
@@ -378,7 +378,7 @@ if options_.irf
                             fprintf(fidTeX,' \n');
                         end
                     end
-                    hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i} ' figure ' int2str(nbplt) '.']);
+                    hh_fig = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i} ' figure ' int2str(nbplt) '.']);
                     m = 0;
                     for plt = 1:number_of_plots_to_draw-(nbplt-1)*nstar
                         m = m+1;
@@ -395,7 +395,7 @@ if options_.irf
                                 title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none');
                             end
                     end
-                    dyn_saveas(hh,[M_.dname, '/graphs/' M_.fname '_IRF_' tit{i} int2str(nbplt) ],options_.nodisplay,options_.graph_format);
+                    dyn_saveas(hh_fig,[M_.dname, '/graphs/' M_.fname '_IRF_' tit{i} int2str(nbplt) ],options_.nodisplay,options_.graph_format);
                     if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
                         fprintf(fidTeX,'\\begin{figure}[H]\n');
                         fprintf(fidTeX,'\\centering \n');
diff --git a/matlab/surgibbs.m b/matlab/surgibbs.m
index 199f9bca28..17b9d6c9d6 100644
--- a/matlab/surgibbs.m
+++ b/matlab/surgibbs.m
@@ -27,7 +27,7 @@ function ds = surgibbs(ds, param_names, beta0, A, ndraws, discarddraws, thin, eq
 %   Combination of Direct Monte Carlo and Importance Sampling Techniques.
 %   Bayesian Analysis Volume 5, Number 1, pp. 65-96.
 
-% Copyright © 2017-2021 Dynare Team
+% Copyright © 2017-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -106,12 +106,12 @@ if ~options_.noprint
     disp('surgibbs: estimating, please wait...')
 end
 
-hh = dyn_waitbar(0,'Please wait. Gibbs sampler...');
-set(hh,'Name','Surgibbs estimation.');
+hh_fig = dyn_waitbar(0,'Please wait. Gibbs sampler...');
+set(hh_fig,'Name','Surgibbs estimation.');
 residdraws = zeros(floor((ndraws-discarddraws)/thin), nobs, m);
 for i = 1:ndraws
     if ~mod(i,10)
-        dyn_waitbar(i/ndraws,hh,'Please wait. Gibbs sampler...');
+        dyn_waitbar(i/ndraws,hh_fig,'Please wait. Gibbs sampler...');
     end
     % Draw Omega, given X, Y, Beta
     resid = reshape(Y - X*beta, nobs, m);
@@ -135,7 +135,7 @@ for i = 1:ndraws
         end
     end
 end
-dyn_waitbar_close(hh);
+dyn_waitbar_close(hh_fig);
 
 %
 % Save results.
diff --git a/matlab/trace_plot.m b/matlab/trace_plot.m
index c08943a66c..a90485ae56 100644
--- a/matlab/trace_plot.m
+++ b/matlab/trace_plot.m
@@ -118,7 +118,7 @@ if n_nblocks_to_plot==1
     if options_.mh_nblck>1
         FigureName = [ FigureName , ' (block number ' int2str(blck)  ').'];
     end
-    hh=dyn_figure(options_.nodisplay,'Name',FigureName);
+    hh_fig=dyn_figure(options_.nodisplay,'Name',FigureName);
     plot(1:TotalNumberOfMhDraws,PosteriorDraws,'Color',[.7 .7 .7]);
 
     % Compute the moving average of the posterior draws:
@@ -137,7 +137,7 @@ if n_nblocks_to_plot==1
     axis tight
     legend({'MCMC draw';[num2str(N) ' period moving average']},'Location','NorthEast')
 else
-    hh=dyn_figure(options_.nodisplay,'Name',FigureName);
+    hh_fig=dyn_figure(options_.nodisplay,'Name',FigureName);
     pp=plot(1:TotalNumberOfMhDraws,PosteriorDraws);
     legend(pp,strcat(repmat({'Chain '},n_nblocks_to_plot,1),num2str(blck(:))));
 end
@@ -160,7 +160,7 @@ if n_nblocks_to_plot==1
 else
     plot_name=[plot_name,'_blck_',save_string];
 end
-dyn_saveas(hh,[M_.dname, filesep, 'graphs', filesep, 'TracePlot_' plot_name],options_.nodisplay,options_.graph_format)
+dyn_saveas(hh_fig,[M_.dname, filesep, 'graphs', filesep, 'TracePlot_' plot_name],options_.nodisplay,options_.graph_format)
 
 if options_.TeX
     fid=fopen([M_.dname,'/graphs/',M_.fname,'_TracePlot_' plot_name,'.tex'],'w+');
diff --git a/tests/estimation/system_prior_restriction/Gali_2015.mod b/tests/estimation/system_prior_restriction/Gali_2015.mod
index 834b211e5c..007a4db24a 100644
--- a/tests/estimation/system_prior_restriction/Gali_2015.mod
+++ b/tests/estimation/system_prior_restriction/Gali_2015.mod
@@ -147,13 +147,13 @@ end;
 varobs yhat;
 
 % Run prior function to get prior slope of the PC based on independent priors
-hh=figure('Name','Slope of the Phillips Curve');
+hh_fig=figure('Name','Slope of the Phillips Curve');
 prior_function(function='Gali_2015_PC_slope');
 PC_slope_vec=cell2mat(oo_.prior_function_results(:,1));
 
 optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
 [density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
-figure(hh)
+figure(hh_fig)
 subplot(3,1,1)
 plot(density(:,1),density(:,2));
 title('Prior')
@@ -165,7 +165,7 @@ posterior_function(function='Gali_2015_PC_slope');
 PC_slope_vec=cell2mat(oo_.posterior_function_results(:,1));
 optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
 [density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
-figure(hh)
+figure(hh_fig)
 subplot(3,1,2)
 plot(density(:,1),density(:,2));
 title('Updated Prior')
@@ -178,7 +178,7 @@ posterior_function(function='Gali_2015_PC_slope');
 PC_slope_vec=cell2mat(oo_.posterior_function_results(:,1));
 optimal_bandwidth = mh_optimal_bandwidth(PC_slope_vec,length(PC_slope_vec),0,'gaussian');
 [density(:,1),density(:,2)] = kernel_density_estimate(PC_slope_vec,512,length(PC_slope_vec),optimal_bandwidth,'gaussian');
-figure(hh)
+figure(hh_fig)
 subplot(3,1,3)
 plot(density(:,1),density(:,2));
 title('Posterior')
-- 
GitLab