unblock

Replace blocks by their contents

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.

Syntax

unblock(b, <blockdomain, <Recurse>>)

Description

unblock(b) replaces all blocks that appear as subexpressions in b by their contents.

unblock(b) replaces all blocks in b by the result of evaluating their content. Thus, unblock(block(a)) should in most cases be equivalent to a. The behavior of unblock may be controlled by additional arguments. If a second argument blockdomain is given, only blocks belonging to a domain that inherits from blockdomain are replaced by their content. If FALSE is provided as a third argument, only b is replaced by its content if it is a block of suitable type itself.

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.

Examples

Example 1

A block is a sort of container that protects its content against evaluation:

y := 1:
bl:= block(1 + y)

Blocks are atomic; thus y and 1 are not visible as operands:

op(bl), nops(bl)

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

unblock(bl)

delete y

Parameters

b

Any object

blockdomain

Any domain that inherits from block

Recurse

TRUE or FALSE

Return Values

In most cases, the object b.

See Also

MuPAD Functions