This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

munlock

Allow clearing function or script from memory

Syntax

munlock(fun)
munlock

Description

example

munlock(fun) 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.

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')
tf =

  logical

   1

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

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

  logical

   0

Input Arguments

collapse all

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

Tips

  • To determine if a file is locked, use the mislocked function.

  • To unlock a MEX file, use the mexUnlock function.

Introduced before R2006a