Simulink Debugger

Use Simulink® debugger to trace problems in your model to specific blocks, parameters, or interconnections

The Simulink debugger allows you to run a simulation one method at a time, and examine the results of executing each method. As the model simulates, you can display information on block states, block inputs and outputs, and block method execution within the Simulink Editor. This allows you to pinpoint problems in your model to specific blocks, parameters, or interconnections.

Use the Simulink debugger to:

  • Monitor single block dynamics (for example, output and update) during a single major time step.

  • Look at state of system while executing a major time step.

  • Observe solver dynamics during a single major step.

Simulink Debugger must be active (started) for all the debugger commands to run.

Simulink also supports debugging with the Simulation Stepper, which lets you step back and forth through your simulation, viewing data and inspecting how and when the system changes states. For information, see How Simulation Stepper Helps With Model Analysis.

Functions

sldebugStart simulation in debug mode

Simulink Debugger Commands

ashowShow algebraic loop
atraceSet algebraic loop trace level for
bafterInsert breakpoint after specified method
breakInsert breakpoint before specified method
bshowShow specified block
clearClear breakpoints from model
continueContinue simulation
dispDisplay block's I/O when simulation stops
ebreakEnable (or disable) breakpoint on solver errors
elistList simulation methods in order in which they are executed during simulation
emodeToggle model execution between accelerated and normal mode
etraceEnable or disable method tracing
helpDisplay help for debugger commands
nanbreakSet or clear nonfinite value break mode
nextAdvance simulation to start of next method at current level in model's execution list
probeI/O and state data for blocks
quitStop simulation debugger
rbreakBreak simulation before solver reset
runRun simulation to completion
slistSorted list of model blocks
statesCurrent state values
statusDebugging options in effect
stepAdvance simulation by one or more methods
stimesModel sample times
stopStop simulation
straceSet solver trace level
systemsList nonvirtual systems of model
tbreakSet or clear time breakpoint
traceDisplay block's I/O each time block executes
undispRemove block from debugger's list of display points
untraceRemove block from debugger's list of trace points
whereDisplay current location of simulation in simulation loop
xbreakBreak when debugger encounters step-size-limiting state
zcbreakToggle breaking at nonsampled zero-crossing events
zclistList blocks containing nonsampled zero crossings

Examples and How To

Start the Simulink Debugger

How to start a simulation from the debugger.

Start a Simulation

How to start a simulation in debug mode.

Run a Simulation Step by Step

How to run a simulation step by step.

Set Breakpoints

How to set breakpoints at blocks and time steps.

Display Information About the Simulation

How to display information about the current simulation.

Display Information About the Model

How to display information about the model being debugged.

Run Accelerator Mode with the Simulink Debugger

How to use the Accelerator mode with the debugger

Concepts

Introduction to the Debugger

Overview of the debugger.

Debugger Graphical User Interface

How to use the debugger graphical user interface.

Debugger Command-Line Interface

How to debug from the MATLAB® command line.

Debugger Online Help

How to get help on debugger commands.

Related Information