Main Content

Simulink.BlockDiagram.getSampleTimes

Return all sample times associated with model

Syntax

ts = Simulink.BlockDiagram.getSampleTimes(mdl)

Description

ts = Simulink.BlockDiagram.getSampleTimes(mdl) updates the block diagram and then returns the sample times associated with the block diagram mdl. Updating the block diagram ensures that the sample time information returned is up to date.

Using this function allows you to access all information in the Timing Legend programmatically.

Input Arguments

mdl

Name or handle of a Simulink® model

Output Arguments

ts

The Simulink.BlockDiagram.getSampleTimes function returns a 1-by-n array of Simulink.SampleTime objects associated with the specified model. 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]
Methods

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

  • Description — A character vector or string 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 or string that represents the annotation of a specific sample time (such as 'D1').

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

  • ComponentSampleTimes — A structure array of elements of the same type as Simulink.BlockDiagram.getSampleTimes if the sample time is an asynchronous union.

Version History

Introduced in R2009a