An S-function is a computer language description of a Simulink® block written in MATLAB®, C, C++, or Fortran. You can develop an S-function to represent external code using an API that interacts with the Simulink engine. Use this S-function with the code generator to produce code. Start with S-Functions and Code Generation.
|Generated S-Function||Represent model or subsystem as generated S-function code|
Use S-functions to extend Simulink support for simulation and code generation.
Add support files and control model code generation and builds within the Simulink Environment.
Implement your algorithm according to the S-function API by writing a C or C++ MEX S-function.
Create S-functions that serve as wrappers for existing code.
Inline your algorithm in the TLC file for code generation.
mdlRTW callback method in an inlined
Explains how to handle rate-grouped tasks in multirate, port-based sample time S-functions.
Generate a shared library from a model or subsystem that you can load dynamically into another application.
Import calls to external code for utility functions, lookup tables, filters, and device drivers into the Simulink environment for simulation and code generation.
Learn how to use the Legacy Code Tool to generate fully inlined C MEX S-functions for legacy or custom code.
Apply Generate S-Function operation to create an S-Function from a subsystem block.