Error Handling

Handle unexpected events in S-Function blocks

S-Function Callback Methods

mdlOutputs Compute the signals that this block emits
mdlGetTimeOfNextVarHit Specify time of the next sample time hit
mdlUpdate Update a block's states
mdlDerivatives Compute the C MEX S-function's derivatives
mdlStart Initialize the state vectors of this C MEX S-function
mdlTerminate Perform any actions required at termination of the simulation

SimStruct Functions

ssGetErrorStatus Get a character vector that identifies the last error
ssPrintf Print a variable-content message
ssSetErrorStatus Report an error
ssWarning Display a warning message

Examples and How To

Error Handling

How to handle errors in a C S-function.


S-Function Callback Methods

Description of S-function callback methods

S-Function SimStruct Functions

Overview of SimStruct macros and functions.

Was this topic helpful?