MATLAB: Integer parameters to C MEX s function

integerparameterss-function

function mxGetPr(ssGetSFcnParam(S,0)) can get REAL parameter from the mask of simulink block. is there any function can get integer paramter from simulink block mask, or how to convert a real number to integer in C MEX s function.
Thanks a lot.
Fengming

Best Answer

I think you need to use mxGetData(ssGetSFcnParam(S,0)) instead and cast the returned void-pointer to an int pointer. You probably want to throw an error if ssGetDTypeIdFromMxArray(ssGetSFcnParam(S,0))!=SS_INT32 (or SS_INT8, SS_UINT8, SS_INT16, SS_UINT16, SS_UINT32 depending on what type you're expecting).
mxGetPr must only be used if the parameter is a double value.