Debug Models Using Simulink Debugger
Using the Simulink® debugger, you can run a simulation of a model method by method. Using breakpoints, you can stop after each method to examine execution results to trace problems in your model to specific blocks, parameters, or interconnections.
Methods are functions that the Simulink software uses to solve a model at each time step during simulation. Blocks consist of several methods.
The Simulink debugger has a graphical user interface and a programmatic interface. The
graphical interface provides the most commonly-used features, and the programmatic interface
provides access to additional debugging options. You can only use the Simulink debugger functions after starting a simulation in the debugger using the
Start Simulation from User Interface
To open the Simulink debugger graphical interface, on the Debug tab, under Breakpoints, click the arrow next to Breakpoints List and select Debug Model.
To start the simulation, click the Start/Continue button on the Simulink debugger toolbar.
The simulation starts and then stops at the first simulation method that is to be executed. The Simulink debugger displays the name of the method in its Simulation Loop pane. At this point, you can:
Run the simulation step by step
Continue the simulation to the next breakpoint or end
Perform other debugging tasks
The Simulink debugger displays the name of the method in the Simulation Loop pane.
The following sections explain how to use the debugger controls to perform these debugging tasks.
When you start the debugger using the Simulink Toolstrip, the debugger programmatic interface also activates in the MATLAB® Command Window. To prevent synchronization errors between the graphical and programmatic interfaces, avoid using the programmatic interface.