munlock - Allow clearing function or script from memory - MATLAB (original) (raw)

Main Content

Allow clearing function or script from memory

Syntax

Description

munlock([fun](#d126e1150100)) unlocks the MATLABĀ® code file named fun. A function that is locked using mlock cannot be removed from memory with the clear command unless you first unlock it using munlock.

example

munlock unlocks the currently running file. Use this syntax only within a MATLAB code file.

Examples

collapse all

Create the function lockFun in your current working folder.

function lockFun() mlock end

At the command prompt, call the lockFun function. Check that the function is locked.

lockFun tf = mislocked('lockFun')

Unlock the function so it can be cleared from memory. Check that the function is not locked.

munlock('lockFun') tf = mislocked('lockFun')

Input Arguments

collapse all

Name of function or script, specified as a character vector or a string scalar.

Tips

Version History

Introduced before R2006a