Create a transparent block 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.




blockTransparent(a) creates a transparent block, which is left unchanged by evaluation, but treated as expression with the same operands as a.

blockTransparent is a domain. If d is any block domain, d(a) creates a block belonging to that domain, with content a.

blockTransparent(a) puts its argument into a block, without evaluating it. In order to evaluate a normally before putting it into a block of some kind, use eval(hold(blockTransparent)(a)).

Transparent blocks are invariant under evaluation, but such blocks have the same operands as their content.

Sequences can also be put into block. In the case of blockTransparent, they are not flattened. See Example 2.

The call expr(b) replaces all transparent blocks in b by their content, without evaluating that content. Thus, expr(blockTransparent(a)) is similar to hold(a).

In case of nested blocks, only the outermost block is removed by both expr and unblock.


Example 1

A block, including transparent blocks, is a sort of container that protects its content against evaluation:

y := 2:
bl := blockTransparent(x + y + z)

Transparent block allow access to the operands of its content:

op(bl,1), subs(bl, hold(y) = y)

delete bl, y

Example 2

A block can also contain a sequence; flattening is suppressed:

blockTransparent((x, y),z)

Example 3

The content of a block can be extracted and evaluated using unblock:

bl := blockTransparent(x + y):
[x, y] := [1, 2]:


delete y



Any object or sequence of objects

Return Values

blockTransparent creates objects of its own type.

See Also

MuPAD Functions