MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Guide de l'utilisateur Page 195

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 210
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 194
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;
}
Vue de la page 194
1 2 ... 190 191 192 193 194 195 196 197 198 199 200 ... 209 210

Commentaires sur ces manuels

Pas de commentaire