From 6e656fbf50402bb70dbd87e2fdc07d30a919ccce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Scylla=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 6 Oct 2017 09:18:55 +0200
Subject: [PATCH] Only set options_.varlist if necessary.

---
 matlab/dynare_estimation_init.m | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m
index daa5edde3..b87b76873 100644
--- a/matlab/dynare_estimation_init.m
+++ b/matlab/dynare_estimation_init.m
@@ -53,15 +53,22 @@ hh = [];
 xparam1 = [];
 
 if isempty(gsa_flag)
-    gsa_flag = 0;
+    gsa_flag = false;
 else
     % Decide if a DSGE or DSGE-VAR has to be estimated.
     if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
         options_.dsge_var = 1;
     end
-    % Get the list of the endogenous variables for which posterior statistics wil be computed
-    var_list_ = check_list_of_variables(options_, M_, var_list_);
-    options_.varlist = var_list_;
+    if isempty(var_list_)
+        var_list_ = check_list_of_variables(options_, M_, var_list_);
+        options_.varlist = var_list_;
+    end
+    if gsa_flag
+        % Get the list of the endogenous variables for which posterior statistics wil be computed.
+        options_.varlist = var_list_;
+    else
+        % This was done in dynare_estimation_1
+    end
 end
 
 if options_.dsge_var && options_.presample~=0
-- 
GitLab