Create a block with some identifiers protected against evaluation

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.




blockIdents(S)(a) creates a transparent block which is evaluated like a, except that the identifiers in S are not substituted by their values, and their properties are not used.

blockIdents is a parametrized family of domains, depending on a set S If d is any block domain, d(a) creates a block belonging to that domain, with content a.

blockIdents(S)(a) replaces all identifiers in a that belong to S by newly created identifiers, evaluates the result and substitutes back; the final result is put into a block. In order to evaluate a normally before putting it into a block, useeval(hold(blockIdents(S))(a)).

Blocks of type blockIdents(S) are evaluated in the same way as their contents at the time of creation.

Blocks of type blockIndents(S) have the same operands as their content.

Sequences can also be put into blocks.

The call expr(b) replaces all transparent blocks in b by their content, without evaluating that content.

In case of nested blocks, expr and unblock remove only the outermost block.


Example 1

A block is a sort of container that protects its content against evaluation. With blockIdents, you can suppress evaluation for particular identifiers:

bl := blockIdents({x,y})(x + y + a):
[a,x,y] := [1,2,3]:

delete x, y:

Example 2

You can extract and evaluate the content of a block using unblock:

bl := blockIdents({y})(x + y):
y := 1:


delete y



Any object or sequence of objects


Set of identifiers

Return Values

blockIdents creates objects of its own type.

See Also

MuPAD Functions