| Writing S-Functions | ![]() |
Initialization Pane
The Initialization pane allows you to specify basic features of the S-function, such as the width of its input and output ports and its sample time.
The S-Function Builder uses the information that you enter on this pane to generate the S-function's mdlInitializeSizes callback method. Simulink invokes this method during the model initialization phase of the simulation to obtain basic information about the S-function. (See How Simulink Interacts with C S-Functions for more information on the model initialization phase.)
The Initialization pane contains the following fields.
Number of discrete states
Number of discrete states that the S-function has.
Discrete states IC
Initial conditions of the S-function's discrete states. You can enter the values as a comma-separated list or as a vector (e.g., [0 1 2]). The number of initial conditions must equal the number of discrete states.
Number of continuous states
Number of continuous states that the S-function has.
Continuous states IC
Initial conditions of the S-function's continuous states. You can enter the values as a comma-separated list or as a vector (e.g., [0 1 2]). The number of initial conditions must equal the number of continuous states.
Sample mode
Sample mode of the S-function. The sample mode determines the length of the interval between the times when the S-function updates its output. You can select one of the following options:
Inherited
Continuous
Discrete
Sample time value
Interval between updates of the S-function's outputs. This field is enabled only if you have selected Discrete as the S-function's Sample time.
| Port/Parameter Pane | Data Properties Pane | ![]() |
© 1994-2005 The MathWorks, Inc.