This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Return all sample times associated with model


ts = Simulink.BlockDiagram.getSampleTimes('model')


ts = Simulink.BlockDiagram.getSampleTimes('model') performs an update diagram and then returns the sample times associated with the block diagram model. The update diagram ensures that the sample time information returned is up to date. If the model is already in the compiled state via a call to the model API, then an update diagram is not necessary.

Using this method allows you to access all information in the Sample Time Legend programmatically.

Input Arguments


Name or handle of a Simulink® model

Output Arguments


The command returns a 1xn array of Simulink.SampleTime objects associated with the model passed to Simulink.BlockDiagram.getSampleTimes. Here n is the number of sample times associated with the block diagram. The format of the returns is as follows:

1xn Simulink.SampleTime
Package: Simulink

value: [1x2 double] Description: [char string] ColorRGBValue: [1x3 double] Annotation: [char string] OwnerBlock: [char string] ComponentSampleTimes: [1x2 struct]

  • value — A two-element array of doubles that contains the sample time period and offset.

  • Description — A character vector that describes the sample time type.

  • ColorRGBValue — A 1x3 array of doubles that contains the red, green, and blue (RGB) values of the sample time color.

  • Annotation — A character vector that represents the annotation of a specific sample time (e.g., 'D1').

  • OwnerBlock — For asynchronous and variable sample times, a character vector containing the full path to the block that controls the sample time. For all other types of sample times, an empty character vector.

  • ComponentSampleTimes — A structure array of elements of the same type as Simulink.BlockDiagram.getSampleTimes if the sample time is an async union or if the sample time is hybrid and the component sample times are available.

Introduced in R2009a

Was this topic helpful?