Error Handling

Handle unexpected events in S-Function blocks

S-Function Callback Methods

mdlOutputsCompute the signals that this block emits
mdlGetTimeOfNextVarHitSpecify time of the next sample time hit
mdlUpdateUpdate a block's states
mdlDerivativesCompute the C MEX S-function's derivatives
mdlStartInitialize the state vectors of this C MEX S-function
mdlTerminatePerform any actions required at termination of the simulation

SimStruct Functions

ssGetErrorStatusGet a character vector that identifies the last error
ssPrintfPrint a variable-content message
ssSetErrorStatusReport an error
ssWarningDisplay 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?