Why matlab crashes when I am trying to change cmex s-function parameter?

When the model is simulated, i can change every parameter. When I am trying to change any parameter before starting simulation, i get Segmentation violation error. When I put into s-function parameters not number, but some letters it is accepted, but Segmentation violation error occurs during creating mask for a block.
Should I change something in my S-function?
in mdlInitializeSizes(SimStruct *S)
ssSetNumSFcnParams(S, 3);
ssSetSFcnParamTunable(S,0,SS_PRM_TUNABLE);
ssSetSFcnParamTunable(S,1,SS_PRM_TUNABLE);
ssSetSFcnParamTunable(S,2,SS_PRM_TUNABLE);
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S))
{return; }
in mdlOutput
int_T first=(int_T)*mxGetPr(ssGetSFcnParam(S,0));
int_T second=(int_T)*mxGetPr(ssGetSFcnParam(S,1));
int_T third=(int_T)*mxGetPr(ssGetSFcnParam(S,2));

Risposte (0)

Categorie

Scopri di più su Block and Blockset Authoring in Centro assistenza e File Exchange

Richiesto:

il 17 Dic 2013

Modificato:

il 17 Dic 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by