Save the state of an identifier
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.
save x1, x2, …_save(
x1, x2, …)
In a procedure, the statement "
saves the state of the global identifier
save statement saves the states of identifiers—i.e.,
their values and properties —
during the execution of procedures.
The original state of the identifiers is restored when procedure execution
is finished. This holds even when an error occurs.
save statement is to be used only inside
the body of a procedure. It cannot be called on the interactive level.
The arguments of the
save statement are evaluated
as usual. In the statement ‘
x must evaluate to an identifier
say. It is the state of the identifier
y that is
save statement is very similar to the
for procedures. The main difference
to the declaration is that, in order to make the declaration, one
has to know the names of the identifiers to be saved in advance. The
allows to save identifiers which are known only at runtime.
save statement is usually used in order
to temporarily change the properties of an identifier, for example
by calling the function
Eventually, the original properties of the identifiers are restored
even if an error occurs.
The statement ‘
save x1, x2, ...;'
is equivalent to the function call
_save(x1, x2, ...).
First, we define a property for the identifier
assume(y < 0)
The properties of the identifier stored in
changed temporarily during the execution of the following procedure
p := proc(x : DOM_IDENT) begin save x; assume(x > 0); is(x > 0) end_proc:
From the procedure's result, we see that the properties of
changed during the execution of
However, the original properties were restored after exiting
y has its original properties:
is(y > 0), is(y < 0)
The restoration of the original properties is guaranteed even
if some error occurs inside the procedure. The following procedure
an error after changing the identifier given by
q := proc(x : DOM_IDENT) begin save x; assume(x > 0); error("some error") end_proc: q(y)
Error: some error [q]
Nevertheless, the original assumptions about
is(y > 0), is(y < 0)
unassume(y): delete p, q:
Symbols evaluating to identifiers
Void object of type