Technical data
Inlining an S-Function
3-33
{
 y[0] = u[0] * GAIN;
}
static void
mdlInitializeSampleTimes(SimStruct *S){}
static void
mdlInitializeConditions(real_T *x0,SimStruct *S) {}
static void
mdlUpdate(real_T *x, const real_T *u,SimStruct *S, int_T tid) {}
static void
mdlDerivatives(real_T *dx, const real_T *x const real_T *u, 
SimStruct *S, int_T tid) {}
static void
mdlTerminate(SimStruct *S) {}
#ifdef MATLAB_MEX_FILE
#include "simulink.c" 
#else
#include "cg_sfun.h"
#endif 
Without a TLC file to define the S-function specifics, RTW must call the 
MEX-file S-function in a manner similar to RTW 1.3. That is, the execution of 
the S-function is through the S-function API.
void
MdlStart()
{
 /* S-Function block: foo */
 {
 SimStruct *s = ssGetSFunction(S, 0);
 real_T *sfcnX = ssGetX(s);
 sfcnInitializeConditions(sfcnX, s);
 }
}
Unnecessary call to 
empty function 
mdlInitializeCondition
s
in foogain.c.










