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.

Digital Clock

Output simulation time at specified sampling interval

  • Library:
  • Simulink / Sources

Description

The Digital Clock block outputs the simulation time only at the specified sampling interval. At other times, the block holds the output at the previous value. To control the precision of this block, use the Sample time parameter in the block dialog box.

Use this block rather than the Clock block (which outputs continuous time) when you need the current simulation time within a discrete system.

Ports

Output

expand all

Sample time, in seconds, at the specified sampling interval. At other times, the block holds the output at the previous value.

Data Types: double

Parameters

expand all

Specify the sampling interval in seconds. You can specify the sampling interval in one of two ways:

  • As the period, specified as a real-valued scalar with data type double.

  • As the period and offset, specified as a real-valued vector of length 2 with data type double. The period and offset must be finite and non-negative, and the offset value must be less than the period.

For more information, see Specifying Sample Time.

Tip

Do not specify a continuous sample time, either 0 or [0,0]. Also, avoid specifying -1 (inheriting the sample time) because this block is a source.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar | vector
Default: '1'

Block Characteristics

Data Types

double

Direct Feedthrough

No

Multidimensional Signals

No

Variable-Size Signals

No

Zero-Crossing Detection

No

Extended Capabilities

See Also

Introduced before R2006a