Documentation

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.

mislocked

Determine if function or script is locked in memory

Syntax

tf = mislocked(fun)
tf = mislocked

Description

example

tf = mislocked(fun) returns true (logical 1) if the function or script fun is locked in memory. Otherwise, it returns false (logical 0).

example

tf = mislocked returns true (logical 1) if the currently running function is locked in memory. Otherwise, it returns false (logical 0).

Use this syntax only within a MATLAB® code file.

Examples

collapse all

Check if the function plot is locked in memory.

tf = mislocked('plot')
tf =

  logical

   0

Create the function myFun in your current working folder. The function calls mislocked on itself to find out if it is locked in memory before and after a call to mlock.

function myFun()
    isLockedBefore = mislocked
    mlock
    isLockedAfter = mislocked
end

At the command prompt, call the function.

myFun
isLockedBefore =

  logical

   0


isLockedAfter =

  logical

   1

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

munlock('myFun')
tf = mislocked('myFun')
tf =

  logical

   0

Input Arguments

collapse all

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

Tips

  • To remove a locked function from memory, first unlock it using the munlock function, and then clear it from memory using the clear function.

  • To determine if a MEX file is locked in memory, use the mexIsLocked function.

See Also

| |

Introduced before R2006a

Was this topic helpful?