MATLAB S-Function Basics - MATLAB & Simulink (original) (raw)

Main Content

Principles of S-function implementation

An S-function is a computer language description of a Simulink® block written in MATLAB®, C, C++, or Fortran®. C, C++, and Fortran S-functions are compiled as MEX files using the mex utility. See Build C MEX Function. As with other MEX files, S-functions are dynamically linked subroutines that the MATLAB execution engine can automatically load and execute. If you haveSimulink Coder™, you can generate code for Level-2 MATLAB S-functions if they are inlined. See Inlining S-Functions (Simulink Coder) for more information.

You can implement S-functions in these ways:

Topics