Start of trail End of trail navigation bar

Table of Contents

time

Returns the current time as a string in hh:mm:ss format.

Syntax

s = time % Returns the current time as a string in hh:mm:ss format
    

Description

Returns a string containing the current time in hh:mm:ss format, where hh is two digits for the hour, mm is two digits for the minutes and ss is two digits for the seconds. Fractional seconds are not returned.

For example, the time may be returned as 10:23:56 indicating 23 minutes and 56 seconds past 10 o'clock.

This function is typically used to get the current time, or with the %{expr} format specifier in various locations. For example, using the string "data-%{time}.mat" as the filename parameter of the To Host File block results in a new data file being generated each time the model is run, with names such as data-10.29.57.mat, data-10.33.29.mat, etc.

Parameters

This function has no parameters.

Outputs

s

The string containing the current time in hh:mm:ss format.

Examples

time  % Returns the current time
    

See Also

 

navigation bar