MATLAB: Is there an example on how to use the Simulink Debugger command line functionality to run a simulation and extract information from a simulation run

debuggerexamplefailedinformationsimulinkstep

I would like an example that walks me through using the Simulink Debugger commands to run a simulation and extract information regarding failed steps, algebraic loop information, block execution order etc.

Best Answer

The attached example files illustrate how to use the Simulink Debugger commands to extract useful information from a simulink diagram or simulation run. The script file "example2.m" will show the following:
1. Leverage the Simulink Debugger to query information on simulation execution in a batched manner (usually done interactively).
2. Use Simulink Debugger to specifically access failed step information when using variable step solvers, specifically identifying the limiting state causing the failure.
3. Parse Debugger information to replace Simulink's state definition or user defined state definition.
The script file also provides exercises that you can try to explore other features available with the Simulink Debugger like accessing block execution order, algebraic loop information and sorted lists of a model.