From 5db86aaf7f3034e5abd7f7ebed7280cde7191a56 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Tue, 18 Dec 2018 12:44:08 +0100
Subject: [PATCH] Use global instead of local variable

---
 matlab/cli/prior.m | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/matlab/cli/prior.m b/matlab/cli/prior.m
index 5779ea3070..2d30186859 100644
--- a/matlab/cli/prior.m
+++ b/matlab/cli/prior.m
@@ -61,11 +61,11 @@ if (size(estim_params_.var_endo,1) || size(estim_params_.corrn,1))
 end
 
 % Fill or update bayestopt_ structure
-[xparam1, EstimatedParams, BayesOptions, lb, ub, Model] = set_prior(estim_params_, M_, options_);
+[xparam1, estim_params_, BayesOptions, lb, ub, Model] = set_prior(estim_params_, M_, options_);
 % Set restricted state space
 options_plot_priors_old=options_.plot_priors;
 options_.plot_priors=0;
-[~,~,~,~, M_, options_, oo_, EstimatedParams, BayesOptions] = ...
+[~,~,~,~, M_, options_, oo_, estim_params_, BayesOptions] = ...
     dynare_estimation_init(M_.endo_names, M_.fname, 1, M_, options_, oo_, estim_params_, bayestopt_);
 options_.plot_priors=options_plot_priors_old;
 
@@ -84,20 +84,20 @@ order = options_.order;
 options_.order = 1;
 
 if ismember('plot', varargin)
-    plot_priors(BayesOptions, Model, EstimatedParams, options_)
+    plot_priors(BayesOptions, Model, estim_params_, options_)
     donesomething = true;
 end
 
 if ismember('table', varargin)
-    print_table_prior(lb, ub, options_, Model, BayesOptions, EstimatedParams);
+    print_table_prior(lb, ub, options_, Model, BayesOptions, estim_params_);
     donesomething = true;
 end
 
 if ismember('simulate', varargin) % Prior simulations (BK).
     if ismember('moments(distribution)', varargin)
-        results = prior_sampler(1, Model, BayesOptions, options_, oo_, EstimatedParams);
+        results = prior_sampler(1, Model, BayesOptions, options_, oo_, estim_params_);
     else
-        results = prior_sampler(0, Model, BayesOptions, options_, oo_, EstimatedParams);
+        results = prior_sampler(0, Model, BayesOptions, options_, oo_, estim_params_);
     end
     % Display prior mass info
     skipline(2)
@@ -119,7 +119,7 @@ if ismember('simulate', varargin) % Prior simulations (BK).
 end
 
 if ismember('optimize', varargin) % Prior optimization.
-    optimize_prior(options_, Model, oo_, BayesOptions, EstimatedParams);
+    optimize_prior(options_, Model, oo_, BayesOptions, estim_params_);
     donesomething = true;
 end
 
@@ -130,7 +130,7 @@ if ismember('moments', varargin) % Prior simulations (2nd order moments).
     k = find(isnan(xparam1));
     xparam1(k) = BayesOptions.p1(k);
     % Update vector of parameters and covariance matrices
-    Model = set_all_parameters(xparam1, EstimatedParams, Model);
+    Model = set_all_parameters(xparam1, estim_params_, Model);
     % Check model.
     check_model(Model);
     % Compute state space representation of the model.
@@ -155,7 +155,7 @@ end
 
 if ismember('moments(distribution)', varargin) % Prior simulations (BK).
     if ~ismember('simulate', varargin)
-        results = prior_sampler(1, Model, BayesOptions, options_, oo_, EstimatedParams);
+        results = prior_sampler(1, Model, BayesOptions, options_, oo_, estim_params_);
     end
     priorpath = [Model.dname filesep() 'prior' filesep() 'draws' filesep()];
     list_of_files = dir([priorpath 'prior_draws*']);
-- 
GitLab