Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

S-Function Limitations

The following table summarizes the major limitations of the different types of S-functions.

ImplementationLimitations
Level-1 M-file S-functionDoes not support the majority of S-function features. See the S-Function Features section for information on what features a Level-1 M-file S-function does support.
Level-2 M-file 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

S-Function Builder
  • Generates S-function code using a wrapper function which incurs additional overhead.

  • Does not support the following S-function features:

    • Work vectors

    • Port-based sample times

    • Multiple sample times or a nonzero offset time

    • Dynamically-sized input and output signals for an S-function with multiple input and output ports

      Note   S-functions with one input and one output port can have dynamically-sized signals

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 states.

  • 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 data types.

  • 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

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS