User`s guide

4 Guidelines for Writing C MEX S-Functions
4-26
rtY.Out1 = rtb_buffer2;
/* S-Function Block: <Root>/S-Function1 */
{
real_T *xData = &rtP.S_Function1.XData[0];
real_T *yData = &rtP.S_Function1.YData[0];
int_T idx;
idx = GetDirectLookupIndex(xData, 5, rtb_Sine_Wave);
rtb_buffer2 = yData[idx];
}
/* Outport Block: <Root>/Out2 */
rtY.Out2 = rtb_buffer2;
}
/* Perform model update */
void MdlUpdate(int_T tid)
{
/* (no update code required) */
}
/* Terminate function */
void MdlTerminate(void)
{
/* (no terminate code required) */
}
#include “sfun_directlook_ex.reg”
/* [EOF] sfun_directlook_ex.c */
This is the code that is
inlined for the bottom
S-function block i n the
sfun_directlook_ex
model.