Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

unprotect

Remove protection of identifiers

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

unprotect(x)

Description

unprotect(x) removes any write protection of the identifier x.

unprotect(x) is equivalent to protect(x, ProtectLevelNone).

unprotect does not evaluate its argument. Cf. Example 2.

Examples

Example 1

unprotect allows to assign values to system functions:

unprotect(sign): sign(x) := 1

However, we strongly advise not to change identifiers protected by the system. We undo the previous assignment:

delete sign(x): protect(sign, ProtectLevelError):

Example 2

unprotect does not evaluate its argument. Here the identifier x is unprotected and not its value y:

x := y:  protect(y): unprotect(x): y := 1
Warning: The protected variable 'y' is overwritten. [_assign]

 Warning: Protected variable
'y' overwritten. [_assign] 

unprotect(y): delete x, y:

Example 3

The identifier a is protected with various levels. unprotect returns the previous protection level:

protect(a):
unprotect(a)

protect(a, ProtectLevelError):
unprotect(a)

At this place, a is not protected:

unprotect(a)

Parameters

x

An identifier

Return Values

Previous protection level of x: either ProtectLevelError or ProtectLevelWarning or ProtectLevelNone (see protect).

See Also

MuPAD Functions

Was this topic helpful?