Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Create array of all zeros

`X = zeros`

`X = zeros(n)`

`X = zeros(sz1,...,szN)`

`X = zeros(sz)`

`X = zeros(___,typename)`

`X = zeros(___,'like',p)`

`X = zeros`

returns the scalar `0`

.

`X = zeros(`

returns
an `sz1,...,szN`

)`sz1`

-by-...-by-`szN`

array of
zeros where `sz1,...,szN`

indicate the size of each
dimension. For example, `zeros(2,3)`

returns a 2-by-3
matrix.

`X = zeros(___,`

returns
an array of zeros of data type `typename`

)`typename`

. For example, `zeros('int8')`

returns
a scalar, 8-bit integer `0`

. You can use any of the
input arguments in the previous syntaxes.