Data type of procedure environments
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.
Procedure environments are mostly ephemeral objects and are only rarely seen by the user (and even more rarely useful to examine). A procedure environment represents a procedure that is currently being executed: formal parameters and local variables have values.
Procedure environments do rarely become visible, and you do
not need to manipulate them directly. They serve only one purpose:
if a procedure is generated inside another procedure, variable names
in the body of the inner procedure that are not declared local there
refer to names in the outer procedure, provided they are declared
local in the outer procedure. (See the Programming Manual for more
information on the scoping rules for MuPAD®.) Consequently, the
inner procedure must contain information on the current values of
local variables of the outer procedure. Hence, the status of the outer
procedure is encoded into an object of type
and that object is stored in the returned procedure as its twelfth
You never need to generate objects of this type. There are no operations available.
The only occasion on which you should come across a procedure environment is the following: an outer procedure returns an inner procedure depending on formal parameters or local variables of the outer procedure:
outer := proc(x) option escape; begin /* inner procedure to return : */ y -> x + y end_proc: add5 := outer(5)
In spite of the (slightly confusing) output,
a special meaning here: it points to the parameter
That parameter currently has the value
5 and won't
be changed any more. To be able to access that value, the particular
outer in the status of being executed
has to be stored in
The number of operands of a procedure environment depends on the number of local and saved variables of the outer procedure. Details about the operands remain undocumented.
The integers appearing in the output of objects of type
no mathematical meaning; they denote positions in memory.