| Writing S-Functions | ![]() |
C Syntax
C Arguments
S
SimStruct representing an S-Function block.
M Syntax
M Arguments
s
Instance of Simulink.MSFcnRunTimeBlock class representing the S-Function block
Description
An S-function needs to provide this optional method only if it does zero-crossing detection. This method should update the S-function's zero-crossing vector, using ssGetNonsampledZCs.
You can use the optional mdlZeroCrossings routine when your S-function has registered the CONTINUOUS_SAMPLE_TIME and has nonsampled zero crossings (ssGetNumNonsampledZCs(S) > 0). The mdlZeroCrossings routine is used to provide Simulink with signals that are to be tracked for zero crossings. These are typically
mdlOutputs
Thus, the zero-crossing signals are used to locate the discontinuities and end the current time step at the point of the zero crossing. To provide Simulink with zero-crossing signals, mdlZeroCrossings updates the ssGetNonsampleZCs(S) vector.
Example
See matlabroot/simulink/src/sfun_zc.c.
Languages
See Also
mdlInitializeSizes, ssGetNonsampledZCs
| mdlUpdate | SimStruct Functions | ![]() |
© 1994-2005 The MathWorks, Inc.