Writing S-Functions | ![]() ![]() |
Templates for C S-Functions
Simulink provides skeleton implementations of C MEX S-functions, called templates, intended to serve as starting points for creating your own S-functions. The templates contain skeleton implementations of callback methods with comments that explain their use. The template file, sfuntmpl_basic.c
, which can be found in the directory simulink/src
below the MATLAB root directory, contains commonly used S-function routines. A template containing all available routines (as well as more comments) can be found in sfuntmpl_doc.c
in the same directory.
![]() | Example of a Basic C MEX S-Function | S-Function Source File Requirements | ![]() |