From d8052342f386612c5c146ac1ae39d9d58cc100ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Wed, 9 Oct 2013 16:26:29 +0200 Subject: [PATCH] Fixed bug introduced in cc0d9b42f0de9be9d2bcda4a763408ba77f9246a (bytecode.cc). Problem when reading nested structures. --- mex/sources/bytecode/bytecode.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc index 0dd0eaf15..fada2bf13 100644 --- a/mex/sources/bytecode/bytecode.cc +++ b/mex/sources/bytecode/bytecode.cc @@ -707,10 +707,16 @@ main(int nrhs, const char *prhs[]) DYN_MEX_FUNC_ERR_MSG_TXT("verbosity is not a field of options_"); if (verbose) print_it = true; - field = mxGetFieldNumber(options_, "simul.maxit");// Not sure of that... - if (field < 0) - DYN_MEX_FUNC_ERR_MSG_TXT("simul.maxit is not a field of options_"); - int maxit_ = int (floor(*(mxGetPr(mxGetFieldByNumber(options_, 0, field))))); + field = mxGetFieldNumber(options_, "simul"); + mxArray *simul; + if (field >= 0) + simul = mxGetFieldByNumber(options_, 0, field); + else + DYN_MEX_FUNC_ERR_MSG_TXT("simul is not a field of options_"); + field = mxGetFieldNumber(simul, "maxit"); + if (field<0) + DYN_MEX_FUNC_ERR_MSG_TXT("maxit is not a field of options_.simul"); + int maxit_ = int (floor(*(mxGetPr(mxGetFieldByNumber(simul, 0, field))))); field = mxGetFieldNumber(options_, "slowc"); if (field < 0) DYN_MEX_FUNC_ERR_MSG_TXT("slows is not a field of options_");