From ba73f71270425b4e1bf6d760b2b942b8bcfc3d16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Sedna=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 6 May 2011 15:53:48 +0200
Subject: [PATCH] Added an error message when a variable is declared as
 oibserved more than once. (cherry picked from commit
 91eb4663696707fb5f651cf2e76699b72e5cba86)

---
 matlab/dynare_estimation_init.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m
index 84099d1b1e..7d55fb9707 100644
--- a/matlab/dynare_estimation_init.m
+++ b/matlab/dynare_estimation_init.m
@@ -44,7 +44,6 @@ else
     if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
         options_.dsge_var = 1;
     end
-    
     var_list_ = check_list_of_variables(options_, M_, var_list_);
     options_.varlist = var_list_;
 end
@@ -53,6 +52,10 @@ options_.lgyidx2varobs = zeros(size(M_.endo_names,1),1);
 for i = 1:size(M_.endo_names,1)
     tmp = strmatch(deblank(M_.endo_names(i,:)),options_.varobs,'exact');
     if ~isempty(tmp)
+        if length(tmp)>1
+            disp(' ')
+            error(['Multiple declarations of ' deblank(M_.endo_names(i,:)) ' as an observed variable is not allowed!'])
+        end
         options_.lgyidx2varobs(i,1) = tmp;
     end
 end
-- 
GitLab