Pref::maxTime

Time limit for computations

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

Pref::maxTime(seconds)
Pref::maxTime(NIL)
Pref::maxTime()

Description

Pref::maxTime(seconds) with seconds greater than 0 sets a time limit for all following MuPAD® instructions. Each computation not finished within the given time raises an error.

The call Pref::maxTime() returns the current value of the time limit without changing it.

The call Pref::maxTime(NIL) switches off the timer watch dog.

Examples

Example 1

No computation should take more than 10 seconds:

Pref::maxTime(10 * unit::sec):

Note that time returns the CPU time in milliseconds. The following while loop is designed to run longer than 10 seconds:

TIME:= time(): 
while time() - TIME < 20000 do null() end_while
Error: Execution time is exceeded. [watchdog-time]
Pref::maxTime(NIL): delete TIME:

Parameters

seconds

The time limit in seconds: a nonnegative integer or an expression involving time units.

Return Values

Previously defined time limit: 0 or an expression involving unit::sec.

See Also

MuPAD Functions

Was this topic helpful?