Documentation Center

  • Trial Software
  • Product Updates

Digital Clock

Output simulation time at specified sampling interval

Library

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, set 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.

Data Type Support

The Digital Clock block outputs a real signal of type double. For more information, see Data Types Supported by Simulink in the Simulink® documentation.

Parameters and Dialog Box

Sample time

Specify the sampling interval. The default value is 1 second. For more information, see Specifying Sample Time in the Simulink documentation.

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.

Examples

In the following modelmodel, the Scope block shows the output of a Digital Clock block with a Sample time of 0.2.

The Digital Clock block outputs the simulation time every 0.2 seconds. Otherwise, the block holds the output at the previous value.

Characteristics

Sample Time

Specified in the Sample time parameter

Scalar Expansion

No

Dimensionalized

No

Multidimensionalized

No

Zero-Crossing Detection

No

See Also

Clock

Was this topic helpful?