Display Port Values for Debugging

Display Port Values for Easy Debugging

For many blocks whose signals carry data, Simulink® can display signal values (block output) as port value labels (similar to tool tips) on the block diagram during and after a simulation. Port value labels display block output values when Simulink runs block output methods. This model shows a port value label for the port on the Fcn block, an output value of –3.03.

If the port value label appears empty, this means that no port value is currently available. For example, toggling a port value label on a continuous block when paused during simulation does not display any values in the label.

Port value labels are also empty when you have not yet simulated the model. This is because the block output methods do not run when the model does not simulate.

If you toggle or hover on a block that Simulink optimizes out of a simulation (such as a virtual subsystem block), while you simulate, the model displays the text optimized.

Displaying port value data tips can help during interactive debugging of a model. For example, the figure shows the output of a thermal model for a house.

These results suggest a problem with the model because:

  • The heating cost is 0 at all temperatures.

  • The temperature inside the house matches ambient temperature almost exactly.

In such cases, debugging the blocks in the model interactively can help isolate the error. Port value labels provide information at the output of every block in the model. So in this example, if you step forward using Simulation Stepper, you can see that the output of the Heater subsystem is 0 at every time step.

To learn more, you can enable port value labels for blocks inside the Heater subsystem. Using Simulation Stepper, if you step forward again to display the values, you can see that there is an issue with the HeatGain block. The output is constant at 0.

This technique helps you isolate the issue.

To simplify debugging, you can turn on and off port value labels during simulation. Besides providing useful information for debugging, port value displays can help you monitor a signal value during simulation. However, these labels are not saved with a model.

For nonnumeric data display, Simulink uses these values:

actionThe signal executes action subsystems.
fcn-callThe signal is a function-call signal, e.g., Function Call Generator output.
groundThe signal is coming from a Ground block.
not a data signalThe signal does not contain valid data, e.g., the signal is from a block that is commented out.

In some cases:

  • The port value display may not be able to acquire the value signal or

  • The signal's value cannot be easily displayed

In such cases, Simulink uses these values.

...The signal dimension exceeds the maximum number of elements Simulink can display. For more information, see Display Port Values for a Model.
(no message)The simulation data available is insufficient. Step forward or press play to obtain more data.
click to add signalsYou have enabled a port value label on a bus. However, you have not selected a signal to display. Click the label to select bus signals.
inaccessibleSimulink cannot obtain the port value. For an example, see Signal Storage Reuse.
[m*n]This is a nonvector signal. Simulink cannot display the actual values of the matrix. It displays the matrix dimension instead.
no data yetThis message appears when:
  • The simulation data is not available. Start the simulation to see values.

  • If the model contains subsystems (for example, an enabled subsystem) and model references and they are not executed during a simulation.

not usedSimulink cannot obtain the signal value due to optimization.
removedSimulink cannot obtain the signal value due to block reduction.
optimizedSimulink cannot obtain the signal value due to optimization. In Normal mode, this message appears for blocks with Conditional input branch execution enabled. For more information, see Conditional Execution Behavior.
unavailableThe simulation data available is insufficient. For example, see Simulation Stepper.

    Note:   You can force a value label to display the signal value by designating the signal as a test point. Use the Properties dialog box to do this.

Display Value for a Specific Port

To display the value of a specific port or port values for a block before simulation, select one or more signals, right-click the selection, and select Show Value Label of Selected Port.

By default, Simulink displays the value of a signal when you click on it during simulation. You can control this behavior in Display > Data Display in Simulation > Options > Display values > Enable by default during simulation.

    Note:   To remove all data tips, select Display > Data Display in Simulation > Remove All Value Labels.

For bus signals, the Show Value Label of Selected Port option opens a dialog box where you can select from all signals in the bus. For example, in this model, you can see the dialog box for all signals that are contained in ModelBus.

You can search for a signal by name or filter through the hierarchy. Select a parent signal to include all of the signals it contains. You can also filter the display to view only those signals you have selected.

Click anywhere outside the dialog box to close it. The port value label appears. The label has no data; it displays values when you simulate the model.

When you simulate the model, the port value label displays the names and values of the signals you chose. To change the signals to display, click on the port value label to reopen the dialog. You can also click on another signal to display its value.

    Note:   Simulink does not save the values of a signal when you remove the port value label.

Display Port Values for a Model

Specify port value display formatting and the frequency of updates. The Value Label Display Options dialog box controls these settings on the entire model.

  1. In the model whose port values you want to display, select Display > Data Display in Simulation > Options.

  2. In the Value Label Display Options dialog box, specify your preferences for:

    • The display options, including font size, the refresh frequency, and the number of elements displayed for vector signals with signal widths greater than 1

    • The display mode

    • Floating-point or fixed-point format

Port Value Display Limitations


Enabling the hovering option for a model or setting at least one block to Toggle Value Labels When Clicked slows down simulation.

Accelerated Modes

Port values work in Normal and Accelerator modes only. They do not work in Rapid Accelerator and External modes. The table shows how accelerator modes affect the display of port values.

Accelerated ModePort Values
  • Signals not optimized in Accelerator mode display port values as in Normal mode. Signals optimized in Accelerator mode display port values as optimized. For more information, see Display Port Values for Easy Debugging.

  • Model reference blocks simulated in Accelerator mode do not get their port value displays updated.

Rapid AcceleratorIncompatible. The limitation exists whether the model or its parent specifies accelerated simulation. For more information, see Accelerate, Refine, and Test Hybrid Dynamic System on Host Computer by Using RSim System Target File.

Signal Storage Reuse

If the output port buffer of a block is shared with another block through the optimization of signal storage reuse, the port value displays as inaccessible. You can disable signal storage reuse using the Configuration Parameters > All Parameters > Signal storage reuse check box. However, disabling signal storage reuse increases the memory used during simulation.

Signal Data Types

  • Simulink displays the port value for ports connected to most kinds of signals, including signals with built-in data types (such as double, int32, or Boolean), DYNAMICALLY_TYPED, and several other data types.

  • Simulink shows the floating format for only noncomplex signal value displays.

  • Simulink displays the port value of fixed point data types based on the converted double value.

  • Simulink does not display data for signals with some composite data types, such as bus signals.


  • You cannot display port values for subsystems contained in a variant subsystem when there are no signal lines connecting to them. In such cases, during simulation, Simulink automatically determines block connectivity based on the active variant. However, you can display port values within the subsystems contained in the variant subsystem. You can also display values on signal lines outside of the variant subsystem.

  • When you disable a conditionally executed subsystem, the port value display for a signal that goes into an Outport block displays the value of the Outport block, depending on the Output when disabled setting.

  • Simulink does not display data for the ports of an enabled subsystem that is not enabled.

Simulation Stepper

If you do not enable port value display when stepping forward, the display will not be available when stepping back. When stepping back, if the port value is unavailable, the unavailable label is displayed.

Refine Factor

Port value displays do not honor refine factor values (Configuration Parameters > Data Import/Export > Additional parameters > Refine factor) because Simulink updates port value displays only during major time steps.

Signal Specification Block and Inport Block

When you display port values on Signal Specification and Inport blocks in a subsystem, the value that is driving the blocks displays instead of the block values.

Command-Line Simulations

For efficiency, Simulink does not support port value displays during a command-line simulation using the sim command.

Merge Block

Simulink does not display the output value of a merge block. To see this value, refer to the source block.

Command Line Interface

You cannot specify port value displays through the command line interface.

Non-Simulink signals

You cannot place port values on non-Simulink signals, such as Simscape™ or SimEvents® signals. This limitation applies to conditional breakpoints as well.

More About

Was this topic helpful?