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

  • 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 193
4 Guidelines for Writing C MEX S-Functions
4-28
/*==============*
* misc defines *
*==============*/
#if !defined(TRUE)
#define TRUE 1
#endif
#if !defined(FALSE)
#define FALSE 0
#endif
/*===========*
* typedef’s *
*===========*/
typedef struct SFcnCache_tag {
boolean_T evenlySpaced;
} SFcnCache;
/*===================================================================*
* Prototype define for the function in separate file lookup_index.c *
*===================================================================*/
extern int_T GetDirectLookupIndex(const real_T *x, int_T xlen, real_T u);
/*=========================*
* Local Utility Functions *
*=========================*/
/* Function: IsRealVect ========================================================
* Abstract:
* Verify that the mxArray is a real vector.
*/
static boolean_T IsRealVect(const mxArray *m)
{
if (mxIsNumeric(m) &&
mxIsDouble(m) &&
!mxIsLogical(m) &&
!mxIsComplex(m) &&
!mxIsSparse(m) &&
!mxIsEmpty(m) &&
mxGetNumberOfDimensions(m) == 2 &&
(mxGetM(m) == 1 || mxGetN(m) == 1))
{
real_T *data = mxGetPr(m);
int_T numEl = mxGetNumberOfElements(m);
int_T i;
for (i = 0; i < numEl; i++) {
if (!mxIsFinite(data[i])) {
return(FALSE);
}
Vue de la page 193
1 2 ... 189 190 191 192 193 194 195 196 197 198 199 ... 209 210

Commentaires sur ces manuels

Pas de commentaire