FUNCTION REFERENCE

zeros

Create an array of all zeros.

Create an array of all zeros.

Syntax

Z = zeros(n)

Syntax

Z = zeros(rows, cols)

Syntax

Z = zeros([rows cols])

zeros(n) is n-by-n. A size vector such as size(A) also works.

Negative sizes count as zero.

Syntax

zeros(..., 'single')

Syntax

zeros(..., 'like', single(1))

Example

zeros(2, 'single')

Example

zeros(2, 3)

Class names 'single' and int8 through uint64 are accepted, as are typed integer/single 'like' prototypes.

Differences from MATLAB: two-dimensional output only; zeros with no size is not supported.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.