The following table summarizes the major limitations of the
different types of S-functions.
|Level-1 MATLAB® S-function||Does not support the majority of S-function features. See the S-Function Features section
for information on what features a Level-1 MATLAB S-function
|Level-2 MATLAB S-functions|
Does not support bus input and output signals.
Cannot incorporate legacy code during simulation,
only during code generation through a TLC file.
|Handwritten C MEX S-function||Supports model referencing with some limitations. See S-Functions with Model Referencing and S-Function
Limitations in Model Referencing Limitations.|
S-functions with one input and one output port can have dynamically-sized
|Legacy Code Tool|
Generates C MEX S-functions for existing functions
written in C or C++ only. The tool does not support transformation
of MATLAB or Fortran functions.
Can interface with C++ functions, but not C++ objects.
Does not support simulating continuous or discrete
Does not support use of function pointers as the output
of the legacy function being called.
Always sets the S-function's flag for direct
feedthrough (sizes.DirFeedthrough) to true.
Supports only the continuous, but fixed in minor time
step, sample time and offset option.
Supports complex numbers, but only with Simulink® built-in
Does not support the following S-function features:
Work vectors, other then general DWork vectors
Frame-based input and output signals
Port-based sample times
Multiple block-based sample times
Was this topic helpful?