Main Content


Display information about specified block each time block executes in simulation debugging session



trace blk registers the block specified by blk as a trace point in the simulation debugging session. The software displays information about the block that corresponds to a trace point each time that block executes in the simulation debugging session.

  • When you start the simulation debugging session programmatically, the information is displayed in the MATLAB® Command Window.

  • When you start the simulation debugging session using the Simulink® Editor, the information is displayed in the Diagnostic Viewer.

You can use this function in a simulation debugging session started:

  • Interactively, using the Simulink Toolstrip

  • Programmatically, using the sldebug function

  • Programmatically, using the sim function with the 'debug' name-value argument


This function is available only for simulation debugging sessions started programmatically and for interactive simulation debugging sessions while paused within a time step.

Input Arguments

collapse all

Block to register as trace point, specified as one of these options:

  • (t)s:b — Block with index b in system with index s and task with index t

  • gcb — Current block


  • To clear a registered trace point, use the untrace function.

  • The software displays the level of information configured for the simulation debugging session. To specify the level of information to display, use the probe function.

  • To start a simulation debugging session interactively, add one or more breakpoints to your model, and in the Breakpoints List, check that Pause within time step is selected. When the simulation pauses on a breakpoint, some of the programmatic debugging commands, such as the stop command, are available for use in the MATLAB Command Window.

Version History

Introduced before R2006a

expand all