User`s guide

Fully Inlined S-Function with the mdlRTW Routine
4-29
}
return(TRUE);
} else {
return(FALSE);
}
}
/* end IsRealVect */
/*====================*
* S-function routines *
*====================*/
#define MDL_CHECK_PARAMETERS /* Change to #undef to remove function */
#if defined(MDL_CHECK_PARAMETERS) && defined(MATLAB_MEX_FILE)
/* Function: mdlCheckParameters ================================================
* Abstract:
* This routine will be called after mdlInitializeSizes, whenever
* parameters change or get re-evaluated. The purpose of this routine is
* to verify that the new parameter settings are correct.
*
* You should add a call to this routine from mdlInitalizeSizes
* to check the parameters. After setting your sizes elements, you should:
* if (ssGetSFcnParamsCount(S) == ssGetNumSFcnParams(S)) {
* mdlCheckParameters(S);
* }
*/
static void mdlCheckParameters(SimStruct *S)
{
if (!IsRealVect(XVECT(S))) {
ssSetErrorStatus(S,”1st, X-vector parameter must be a real finite
“ vector”);
return;
}
if (!IsRealVect(YVECT(S))) {
ssSetErrorStatus(S,”2nd, Y-vector parameter must be a real finite
“vector”);
return;
}
/*
* Verify that the dimensions of X and Y are the same.
*/
if (mxGetNumberOfElements(XVECT(S)) != mxGetNumberOfElements(YVECT(S)) ||
mxGetNumberOfElements(XVECT(S)) == 1) {
ssSetErrorStatus(S,”X and Y-vectors must be of the same dimension
“and have at least two elements”);
return;
}