| Writing S-Functions | ![]() |
Callback Methods
The Level-2 M-file S-function API specifies a set of callback methods that an M-file S-function must implement and others that it may choose to omit, depending on the requirements of the block that the S-function defines. The methods defined by the Level-2 M-file S-function API generally correspond to that of similarly named methods defined by the C MEX-file S-function API. For information on what each method does, see "How Simulink Works" chapter of the Simulink manual) and S-Function Callback Methods.
The following table lists the Level-2 M-file S-function callback methods and their C MEX-file counterparts.
| Level-2 M-File Method |
C MEX-File Method |
| Main function (see Main Method) |
mdlInitializeSizes |
CheckParameters |
mdlCheckParameters |
Derivatives |
mdlDerivatives |
Disable |
mdlDisable |
Enable |
mdlEnable |
InitializeCondition |
mdlInitializeConditions |
Outputs |
mdlOutputs |
ProcessParameters |
mdlProcessParameters |
SetInputPortComplexSignal |
mdlSetInputPortComplexSignal |
SetInputPortDataType |
mdlSetInputPortDataType |
SetInputPortDimensions |
mdlSetInputPortDimensionInfo |
SetInputPortSampleTime |
mdlSetInputPortSampleTime |
SetInputPortSamplingMode |
mdlSetInputPortFrameData |
SetOutputPortComplexSignal |
mdlSetOutputPortComplexSignal |
SetOutputPortDataType |
mdlSetOutputPortDataType |
SetOutputPortDimensions |
mdlSetOutputPortDimensionInfo |
SetOutputPortSampleTime |
mdlSetOutputPortSampleTime |
Start |
mdlStart |
Update |
mdlUpdate |
WriteRTW |
mdlRTW |
ZeroCrossings |
mdlZeroCrossings |
| Writing Level-2 M-File S-Functions | Main Method | ![]() |
© 1994-2005 The MathWorks, Inc.