For many blocks whose signals carry data, Simulink® can display signal values (block output) as data tips (similar to tool tips) on the block diagram during and after a simulation. This model shows a data tip for the port on the Fcn block, an output value of –3.03.
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 non-numeric data display, Simulink uses these strings:
|The signal executes action subsystems.|
|The signal is a function-call signal, e.g., Function Call Generator output.|
|The signal is coming from a Ground block.|
|The 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 strings:
|...||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.|
|Simulink cannot obtain the port value. For an example, see Signal Storage Reuse.|
|This is a nonvector signal. Simulink cannot display the actual values of the matrix. It displays the matrix dimension instead.|
|Simulink cannot obtain the signal value due to optimization.|
|Simulink cannot obtain the signal value due to block reduction.|
|Simulink cannot obtain the signal value due to optimization.|
|The 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.
In the Simulink Editor model window, select the signal that is connected to the port whose value you want to display or the block whose port values you want to display.
Select Display > Data Display in Simulation > Show Value Label of Selected Port.
Note: To remove the data tips, select Display > Data Display in Simulation > Remove All Value Labels.
Specify port value display formatting and the frequency of updates. The Value Label Display Options dialog box controls these settings on the entire model.
In the model whose port values you want to display, select Display > Data Display in Simulation > Options.
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
An empty box can appear when you toggle or hover on a block. This means that no port value is currently available. For example, toggling a port value label on a continuous block when paused during simulation can display an empty box. You also see the empty box if you have not yet simulated the model.
If you toggle or hover on a block that Simulink optimizes
out of a simulation (such as a virtual subsystem block), the model
displays the string
optimized while you simulate.
Enabling the hovering option for a model or setting at least one block to Toggle Value Labels When Clicked slows down simulation.
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 Mode||Port Values|
|Rapid Accelerator||Incompatible. The limitation exists whether the model or its parent specifies accelerated simulation. For more information, see Rapid Simulations.|
If the output port buffer of a block is shared with another
block through the optimization of signal storage reuse, the port value
inaccessible. You can disable signal
storage reuse using the Configuration Parameters > Optimization > Signals and Parameters > Signal storage reuse check
box. However, disabling signal storage reuse increases the memory
used during simulation.
Simulink displays the port value for ports connected
to most kinds of signals, including signals with built-in data types
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.
For models that use inline parameters (models that have Configuration Parameters > Optimization > Signals and Parameters > Inline parameters enabled), Simulink does not display port values for signals such as:
Constant input to an Enable block
Outputs of an Enable block that is never enabled
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.
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
Port value displays do not honor refine factor values (Configuration Parameters > Data Import/Export > Refine factor) because Simulink updates port value displays only during major time steps.
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.
For efficiency, Simulink does not support port value displays
during a command-line simulation using the
Simulink does not display the output value of a merge block. To see this value, refer to the source block.
You cannot specify port value displays through the command line interface.
You cannot place port values on non-Simulink signals, such as Simscape™ or SimEvents® signals. This limitation applies to conditional breakpoints as well.