Simulink® models can display color coding and annotations that represent specific sample times. Each sample time type has one or more colors associated with it. You can display the blocks and signal lines in color, the annotations in black, or both. To select one of these options:
In the Simulink model window, select Display > Sample Time.
Select Colors, Annotations, or All.
Selecting All results in the display of both the colors and the annotations. Regardless of your choice, Simulink performs an Update Diagram automatically. To turn off the colors and annotations:
Select Display > Sample Time.
Simulink performs another Update Diagram automatically.
Your Sample Time Display choices directly control the information that the Timing Legend displays.
The discrete sample times in the table Designations of Sample Time Information represent a special case. Five colors indicate the speed through the fifth fastest discrete rate. A sixth color, orange, represents all rates that are slower than the fifth discrete rate. You can distinguish between these slower rates by looking at the annotations on their respective signal lines.
You can view the Timing Legend for an individual model or for multiple models. Additionally, you can prevent the legend from automatically opening when you select options on the Sample Time menu.
To assist you with interpreting a block diagram, the Timing Legend contains the sample time color, annotation, and value for each sample time in the model. To view the legend:
In the Simulink model window, select Simulation > Update Diagram.
Select Display > Sample Time > Timing Legend or press Ctrl + J OR Select All from the Sample Time menu
In addition, when you select Colors or Annotations, Simulink updates the model diagram and opens the legend by default. The legend contents reflect your Sample Time Display choices. If you turn colors on, the legend displays the color and the value of the sample time. Similarly, if you turn annotations on, the annotations appear in the legend.
The legend displays sample times present in the model, classified by the type of the sample time.
The legend provides two types of highlighting options:
Highlighting the blocks and signals that the sample time originates from.
Highlighting all the blocks and signals that contain the selected sample time.
To enable highlighting of the origin of the sample times, click the
Origin option from the Highlight
menu. You can also click the type of the sample time to highlight all sources of a
particular type of sample time.
To enable highlighting of all the blocks that contain a selected sample time,
All option from the
Highlight menu. You can also click the type of the sample
time to highlight all the blocks and signals that contain the select type of sample
None option from the Highlight
menu clears current highlighting.
The button shows discrete value as 1/period when the discrete sample time is present. When clicked, the discrete period is displayed as 1/period; for a nonzero offset, it displays as offset/period. The image shows 1/period values and the corresponding highlighted block in the model.
The Timing Legend displays all of the sample times in the model, including those that are not associated with any block. For example, if the fixed step size is 0.1 and all of the blocks have a sample time of 0.2, then both rates (0.1 and 0.2) appear in the legend.
For subsequent viewings of the legend, update the diagram to access the latest known information.
If you do not want to view the legend upon selecting Sample Time Display:
In the Simulink Editor, select File > Simulink Preferences
In the General pane, clear Open the timing legend when the sample time display is changed and click Apply.
The Model Data Editor (View > Model Data Editor) shows information about model data (signals, parameters, and states)
in a sortable, searchable table. The Sample Time column shows
the sample time specified for each signal in a model. After you update the block
diagram, the column also shows the specific sample that each signal uses (for
example, for signals for which you specify inherited sample time,
-1). You can also use this column to specify sample times.
For more information about the Model Data Editor, see Configure Data Properties by Using the Model Data Editor.