Information about reserved identifiers

MuPAD® notebooks will be removed in a future release. 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.




prog::isGlobal(ident) checks whether the identifier ident is “used by the system”. Here, “used by the system” means that ident is an environment variable (e.g., PRETTYPRINT), a system-wide constant (e.g., PI or undefined), an option (for some function call, e.g., All), or a system function (such as sin).

The most of those identifiers are protected (see protect).


Example 1

Assume you would like to use some identifiers as options for a new function you wrote. In this example, we will check the elements of the list [All, Beta, Circle, D, eval, First] for suitability. (Note that eval would not be a good choice, even if it was not a system function, because options should start with a capital letter.)

We define a test function which is mapped to the list and returns FAIL, if the tested object is not an identifier, TRUE, if the identifier is used by the system and FALSE otherwise:

LIST:= [All, Beta, Circle, D, eval, First]:
map(LIST, X -> if domtype(X) <> DOM_IDENT then
                 X = FAIL
                 X = prog::isGlobal(X)

The identifiers All and First can be used as options because they have already been protected by the system (actually, they are already used as options, which makes them a good choice), the identifiers Beta and Circle are free and one must only take care that they have no value if they will be used as options—they should be protected first. D and eval have values and cannot be used as options.



Identifier to check

Return Values

prog::isGlobal return TRUE, if the given identifier is used by the system, otherwise FALSE.

See Also

MuPAD Functions