From fcd016dc25341601b5537e64433a79fcd61b9ab5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Thu, 28 Jun 2012 18:05:24 +0200
Subject: [PATCH] Removed global from check_model routine.

---
 matlab/check_model.m        | 13 +++++--------
 matlab/stoch_simul.m        |  2 +-
 matlab/stoch_simul_sparse.m |  2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/matlab/check_model.m b/matlab/check_model.m
index 7e15d8d1c7..8ab34e3931 100644
--- a/matlab/check_model.m
+++ b/matlab/check_model.m
@@ -1,4 +1,4 @@
-function check_model()
+function check_model(DynareModel)
 
 % Copyright (C) 2005-2011 Dynare Team
 %
@@ -17,10 +17,8 @@ function check_model()
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-global M_
-
-xlen = M_.maximum_exo_lag+M_.maximum_exo_lead + 1;
-if ~ M_.lead_lag_incidence(M_.maximum_lag+1,:) > 0
+xlen = DynareModel.maximum_exo_lag+DynareModel.maximum_exo_lead + 1;
+if ~ DynareModel.lead_lag_incidence(DynareModel.maximum_lag+1,:) > 0
     error ('RESOL: Error in model specification: some variables don"t appear as current') ;
 end
 
@@ -29,8 +27,7 @@ if xlen > 1
             ' current period. Use additional endogenous variables']) ;
 end
 
-if (M_.exo_det_nbr > 0) && (M_.maximum_lag > 1 || M_.maximum_lead > 1)
+if (DynareModel.exo_det_nbr > 0) && (DynareModel.maximum_lag > 1 || DynareModel.maximum_lead > 1)
     error(['Exogenous deterministic variables are currently only allowed in' ...
            ' models with leads and lags on only one period'])
-end
-
+end
\ No newline at end of file
diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m
index b3eb9913f8..8370f77fde 100644
--- a/matlab/stoch_simul.m
+++ b/matlab/stoch_simul.m
@@ -60,7 +60,7 @@ if M_.exo_nbr > 0
     oo_.exo_simul= ones(iter_ + M_.maximum_lag + M_.maximum_lead,1) * oo_.exo_steady_state';
 end
 
-check_model;
+check_model(M_);
 
 oo_.dr=set_state_space(dr,M_);
 
diff --git a/matlab/stoch_simul_sparse.m b/matlab/stoch_simul_sparse.m
index 7be80a78b1..eaa6e5764c 100644
--- a/matlab/stoch_simul_sparse.m
+++ b/matlab/stoch_simul_sparse.m
@@ -36,7 +36,7 @@ if M_.exo_nbr > 0
     oo_.exo_simul= ones(iter_ + M_.maximum_lag + M_.maximum_lead,1) * oo_.exo_steady_state';
 end
 
-check_model;
+check_model(M_);
 
 [oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
 
-- 
GitLab