You can create C/C++ S-functions by writing an S-function from scratch, using the S-function builder, or using the Legacy Code Tool. Each of these approaches involves a tradeoff between the ease of writing an S-function and the features supported by the S-function.
S-Function | Include S-function in model |
S-Function Builder | Integrate C or C++ code to create S-functions |
Create a Basic C MEX S-Function
Construct the code to create an S-function.
Simulink Engine Interaction with C S-Functions
Learn how the Simulink® engine interacts with a C S-function to create and debug your own C S-functions.
Implement S-function callback methods.
S-Function SimStruct Functions
Access Simulink data structure through SimStruct macros and functions.
Use code templates as starting points for writing your own C S-functions.
Model systems through C MEX S-function examples.
Create various types of S-functions and S-function features.
Perform mxArray
manipulation in C S-functions.
Convert Level-1 C MEX S-Functions
Convert S-functions written for earlier Simulink releases to work with the current version.
Create a C++ S-function from a C S-function.
Create C++ objects that persist across invocations of the S-function.
Build a C++ S-function.