Main Content

Debugger Command-Line Interface

Controlling the Debugger

In command-line mode, you control the debugger by entering commands at the debugger command line in the MATLAB® Command Window. To enter commands at the debugger command line, you must start the debugger programmatically and not through the GUI. Use sldebug for this purpose. The debugger accepts abbreviations for debugger commands. For more information on debugger commands, see Simulink Debugger.


You can repeat some commands by entering an empty command (i.e., by pressing the Enter key) at the command line.

Method ID

Some of the Simulink® software commands and messages use method IDs to refer to methods. A method ID is an integer assigned to a method the first time the method is invoked. The debugger assigns method IDs sequentially, starting with 0.

Block ID

Some of the debugger commands and messages use block IDs to refer to blocks. Block IDs are assigned to blocks while generating the model's sorted lists during the compilation phase of the simulation. A block ID has the form sysIdx:blkIdx, where sysIdx is an integer identifying the system that contains the block (either the root system or a nonvirtual subsystem) and blkIdx is the position of the block in the system's sorted list. For example, the block ID 0:1 refers to the first block in the model's root system. The slist command shows the block ID for each debugged block in the model.

Accessing the MATLAB Workspace

You can enter any MATLAB expression at the sldebug prompt. For example, suppose you are at a breakpoint and you are logging time and output of your model as tout and yout. The following command creates a plot.

(sldebug ...) plot(tout, yout)

You cannot display the value of a workspace variable whose name is partially or entirely the same as that of a debugger command by entering it at the debugger command prompt. You can, however, use the eval command to work around this problem. For example, use eval('s') to determine the value of s rather than step the simulation.

Related Examples

More About