munlock

Allows a locked function or script file to be cleared from memory again.

Category: Programming > Functions

Syntax

munlock

Unlocks the file that is currently running, normally called from inside the file.

munlock(fun)

Unlocks the function named by the text fun.

Description

mlock pins a function in memory so that clear does not discard it along with its persistent variables. munlock reverses that, making the file eligible to be cleared again. Calling it on a file that is not locked does nothing.

Input arguments

fun
Name of a function, as a character vector or string.

Example

Unlocking a function by name

munlock('sin');
disp(mislocked('sin'))
Output
   0

Notes

In MatLivre munlock unlocks the function and mislocked then reports 0. clear never resets the persistent variables of any function, locked or not, so locking has no effect on it.

See also

mlock mislocked clear