Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

View Sample Time Information

View Sample Time Display

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:

  1. In the Simulink model window, select Display > Sample Time.

  2. 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:

  1. Select Display > Sample Time.

  2. Select Off.

Simulink performs another Update Diagram automatically.

Your Sample Time Display choices directly control the information that the Sample Time Legend displays.

Note

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.

Sample Time Legend

You can view the Sample Time 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.

Viewing the Legend

To assist you with interpreting your block diagram, a sample time legend contains the sample time color, annotation, description, and value for each sample time in the model. To view the legend:

  1. In the Simulink model window, select Simulation > Update Diagram.

  2. Select Display > Sample Time > Sample Time 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. By default or if you have selected Off, the legend contains a description of the sample time and the sample time value. If you turn colors on, the legend displays the appropriate color beside each description. Similarly, if you turn annotations on, the annotations appear in the legend.

For asynchronous and controllable sample times, the legend displays a link to the block that controls the sample time in place of the sample time value. Clicking on these links highlights the corresponding block in the block diagram. If the controller block of the sample time is in a reference model and not in the top model, the legend displays a link to the block in the reference model. To go to the controller block, you can enter the reference model.

The rate listed does not apply in hybrid models because these blocks do not have a single representative sample time.

The checkbox to show discrete value as 1/period is enabled when the discrete rate is present. When checked, the discrete period is displayed as 1/period; for a nonzero offset, it displays as offset/period. The image shows you 1/period values and the corresponding highlighted block in the model.

You can click on the radio button to highlight the blocks corresponding to each rate shown in the legend. Select one rate at a time to highlight the corresponding blocks. The Clear Highlighting button clears the highlighting from the model.

Note

The Sample Time 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.

Turning the Legend Off

If you do not want to view the legend upon selecting Sample Time Display:

  1. In the Simulink Editor, select File > Simulink Preferences

  2. In the General pane, clear Open the sample time legend when the sample time display is changed and click Apply.

Viewing Multiple Legends

If you have more than one model open and you view the Sample Time Legend for each one, a single legend window appears with multiple tabs. Each tab contains the name of the model and the respective legend information. The figure shows the tabbed legends for the f14 and vdp models.

Inspect Sample Times Throughout a Model

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 you the sample time specified for each signal in a model. After you update the block diagram, the column also shows you the specific sample that each signal uses (for example, for signals for which you specify inherited sample time, -1). You can also use the column to specify sample times.

For more information about the Model Data Editor, see Configure Data Properties by Using the Model Data Editor.

See Also

| |

Was this topic helpful?