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.

Digital Clock

Output simulation time at specified sampling interval




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.


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.


In the following model, 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.


Data Types


Sample Time

Specified in the Sample time parameter

Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Code Generation


See Also


Introduced before R2006a

Was this topic helpful?