From 0a8be249385a0813b5e0f9c1ab9a1ebf43ded5dd Mon Sep 17 00:00:00 2001
From: Ferhat Mihoubi <ferhat.mihoubi@univ-evry.fr>
Date: Fri, 16 Mar 2012 14:38:32 +0100
Subject: [PATCH] Add an error message if options_.dynatol.f is used instead of
 options_.dynatol

---
 mex/sources/bytecode/bytecode.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index 65852e1700..dbd99a0a46 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -299,7 +299,10 @@ main(int nrhs, const char *prhs[])
   else
     {
       solve_algo = stack_solve_algo;
-      solve_tolf = *(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "dynatol"))));
+      mxArray *dynatol = mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "dynatol"));
+      if (mxIsStruct(dynatol))
+        DYN_MEX_FUNC_ERR_MSG_TXT("Fatal error in bytecode: in main, dynatol is not a structure in this version of dynare. \n Use options_.dynatol = value;\n");   
+      solve_tolf = *mxGetPr(dynatol);
     }
 
   mxArray *mxa = mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_, "fname"));
-- 
GitLab