unalias
Deletes an alias
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.
unalias(x_{1}, x_{2}, …
, <Global>)
unalias(<Global>)
unalias(x)
deletes the abbreviation or macro x
.
To delete a macro defined by alias(f(y1, y2, ...) = object)
,
use unalias(f)
. If no alias for x
or f
is
defined, then the call is ignored.
unalias()
deletes all abbreviations and macros.
Multiple alias definitions may be deleted by a single call of unalias
.
The call unalias()
deletes all currently defined
aliases.
unalias
does not evaluate its arguments.
If you use an identifier as an abbreviation, you cannot use
that same identifier directly. You must use unalias
before
you can define another abbreviation or macro for the same identifier.
See Example 2.
Assigning a value to one of the identifiers on the left side of an alias definition, or deleting its value does not affect the alias substitution, neither in the input nor in the output.
alias
with at least one argument and unalias
change
the parser configuration in the way described in the “Details”
section.
Define d
as a shortcut for diff
:
delete f, g, x, y: alias(d = diff): d(sin(x), x) = diff(sin(x), x); d(f(x, y), x) = diff(f(x, y), x)
Define a macro Dx(f)
for diff(f(x),
x)
. Note that hold
does
not prevent alias substitution:
alias(Dx(f) = diff(f(x), x)): Dx(sin); Dx(f + g); hold(Dx(f + g))
After the call unalias(d, Dx)
, no alias substitutions
happen any longer:
unalias(d, Dx): d(sin(x), x), diff(sin(x), x), d(f(x, y), x), diff(f(x, y), x); Dx(sin), Dx(f + g)
Define a
to be an abbreviation for b
.
Then the next alias definition is really an alias definition for b
:
delete a, b: alias(a = b): alias(a = 2): type(a), type(b); unalias(b):
Use unalias
first before defining another
alias for the identifier a
:
unalias(a): alias(a = 2): type(a), type(b); unalias(a):
A macro definition, however, can be added if the newly defined
macro has a different number of arguments. unalias(a)
removes
all macros defined for a
:
alias(a(x)=sin(x^2)): a(y); alias(a(x)=cos(x^2)):
Error: Invalid operand. [_power] Evaluating: alias
alias(a(x, y) = sin(x + y)): a(u, v); alias(): unalias(a):
a(x) = sin(x^2)
a(x, y) = sin(x + y)
When called without arguments, alias
just
displays all currently used aliases:
alias(a = 5, F(x) = sin(x^2)): alias(); unalias(F, a):
F(x) = sin(x^2)
a = 5

Identifiers or symbolic expressions
of the form 

Any MuPAD^{®} objects 

Definition of an alias in the global parser context. When an alias is defined in a library or package source file,
it will be deleted automatically after reading the file. With option 
Both alias
and unalias
return
the void object of type DOM_NULL
.
The aliases are stored in the parser configuration table displayed
by _parser_config()
. Note that by default, alias
backsubstitution happens for the right sides of the equations in
this table, but not for the indices. Use print(_parser_config())
to
display this table without alias backsubstitution.
Aliases are not used while a file is read using read
or fread
with the option Plain
.
Conversely, if an alias is defined in a file which is read with option
the Plain
, the alias is only used until the file
has been read completely.