Main Content

Debug Simulations Programmatically

Debug and analyze simulations in the MATLAB® Command Window, set breakpoints, step through time steps and block methods

The Simulink® debugging programmatic interface provides debugging options in the MATLAB Command Window that are similar to those available in the Simulink Editor. In addition, you can use the programmatic interface to:

  • Step through model execution one block method at a time.

  • Set breakpoints on block methods.

  • Set additional model breakpoints, such as the solver reset breakpoint.

  • Display additional information about the model, including a list of nonvirtual subsystems.

The functions for controlling data display and model execution in a simulation debugging session are available only after you start the debugging session.

Functions

expand all

sldebugStart simulation debugging session for Simulink model
bafterInsert breakpoint after specified method in simulation debugging session
breakInsert breakpoint before specified method in simulation debugging session
clearClear breakpoint in simulation debugging session
continueContinue simulation debugging session
ebreakSet or clear breakpoint to pause when solver error occurs in simulation debugging session
emodeSwitch between accelerator and normal mode during simulation debugging session
nanbreakSet or clear breakpoint to pause when Inf or NaN value occurs in simulation debugging session
nextProgress simulation debugging session to start of next method in model execution list
quitEnd simulation debugging session
rbreakConfigure simulation debugging session to pause before solver reset
runRun simulation debugging session from current point to end of simulation, ignoring breakpoints
stepAdvance simulation by specified increment
stopStop simulation debugging session
tbreakSet or clear breakpoint that pauses simulation debugging session at specified time
xbreakSet or clear breakpoint to pause when state limits step size in simulation debugging session
zcbreakConfigure simulation debugging session to pause when nonsampled zero-crossing events occur
ashowIdentify and highlight algebraic loops in simulation debugging session
atraceConfigure simulation debugging session to display information each time algebraic loop is solved
bshowHighlight block in model with specified block ID during simulation debugging session
dispDisplay information about specified block when simulation debugging session pauses
elistDisplay execution order in simulation debugging session
etraceConfigure simulation debugging session to display information when entering and exiting methods
helpDisplay help for Simulink debugging programmatic interface during simulation debugging session
probeDisplay input, output, and state data for specified block in simulation debugging session
slistDisplay sorted list of blocks in model during simulation debugging session
statesDisplay state values during simulation debugging session
statusDisplay options used in current simulation debugging session
stimesDisplay information about sample times in model during simulation debugging session
straceDisplay solver information in simulation debugging session
systemsList nonvirtual subsystems in model or model hierarchy during simulation debugging session
traceDisplay information about specified block each time block executes in simulation debugging session
undispRemove display point in simulation debugging session
untraceRemove trace point in simulation debugging session
whereDisplay current location within simulation loop during simulation debugging session
zclistList blocks that detect zero crossings in simulation debugging session

Topics