isLocked

Tests whether a System object, or a function, is locked.

Category: Programming > Classes

Syntax

tf = isLocked(obj)

Returns true if the System object has been run and its settings are fixed.

tf = mislocked(name)

The matching check for a function locked with mlock.

Description

A System object becomes locked the first time it is called, which freezes the properties that cannot change while the object holds state, such as the size and data type of the input. release unlocks it so that the settings can be changed. isLocked reports which of the two states the object is in.

For ordinary functions the same idea is mlock: a locked function keeps its persistent variables when clear is used, and mislocked tells whether a function is in that state.

Input arguments

obj
A System object.
name
Function name, for mislocked.

Output arguments

tf
Logical scalar.

Example

The function-level counterpart

mislocked('sin')
Output
ans = logical
   0

Notes

System objects are not available in MatLivre, so isLocked itself cannot be called; the example uses mislocked.

See also

mislocked mlock munlock clone isDone