| Writing S-Functions | ![]() |
Defining S-Function Block Characteristics
For Simulink to recognize an M-file S-function, you must provide it with specific information about the S-function. This information includes the number of inputs, outputs, states, and other block characteristics.
To give Simulink this information, call the simsizes function at the beginning of mdlInitializeSizes.
This function returns an uninitialized sizes structure. You must load the sizes structure with information about the S-function. The table below lists the fields of the sizes structure and describes the information contained in each field.
After you initialize the sizes structure, call simsizes again:
This passes the information in the sizes structure to sys, a vector that holds the information for use by Simulink.
| S-Function Outputs | Processing S-Function Parameters | ![]() |