The following table gives an overview of how to write different types of S-functions. See the associated sections of the S-function documentation for more details on how to implement S-functions using a particular method.
For backward compatibility, the following table and sections contain information about Level-1 MATLAB® S-functions. However, use the Level-2 MATLAB S-function API to develop new MATLAB S-functions.
S-Function Type | Implementation |
---|---|
Level-1 MATLAB S-function | Use the following template to write a new Level-1 MATLAB S-function: sfuntmpl.m See Maintain Level-1 MATLAB S-Functions for more information. |
Level-2 MATLAB S-function |
|
Hand-written C MEX S-function |
|
S-Function Builder |
|
Legacy Code Tool | Use the legacy_code function to perform the following steps
(see Integrate C Functions Using Legacy Code Tool):
|