Generate the void object of type DOM_NULL

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.




null() returns the void object of domain type DOM_NULL. It represents an empty sequence of MuPAD® expressions or statements.

The void object does not produce any output on the screen.

Various systems functions such as print or reset return the void object.

The void object is removed from sequences (“flattening”). It can be used to remove elements from lists or sets. Cf. Example 2.


Example 1

null() returns the void object which does not produce any screen output:


The resulting object is of domain type DOM_NULL:


This object represents the empty expression sequence and the empty statement sequence:

domtype(_exprseq()), domtype(_stmtseq())

Some system functions such as print return the void object:

print("Hello world!"):


Example 2

The void object is removed from lists, sets, and expression sequences:

[null(), a, b, null(), c], {null(), a, b, null(), c}, 
f(null(), a, b, null(), c)

a + null() + b = _plus(a, null(), b)

subsop([a, x, b], 2 = null()), subs({a, x, b}, x = null())

However, null() is a valid entry in arrays and tables:

a := array(1..2): a[1] := 1: a[2] := null(): a

domtype(a[1]), domtype(a[2])

t := table(null() = "void", 1 = 2.5, b = null())

domtype(t[b]), t[]

delete a, t:

Example 3

The void object remains if you delete all elements from an expression sequence:

a := (1, b): delete a[1]: delete a[1]: domtype(a)

The operand function op returns the void object when applied to an object with no operands:

domtype(op([])), domtype(op({})), domtype(op(f()))

delete a:

Return Values

Void object of domain type DOM_NULL.

See Also

MuPAD Functions