zeros
Array of all zeros.
Syntax
Section titled “Syntax”B = zeros % scalar 0B = zeros(n) % n×n squareB = zeros(m, n) % m×nB = zeros(d1, d2, d3, ...)B = zeros([d1 d2 …])B = zeros(…, classname)Description
Section titled “Description”Creates an array of all zeros with the given dimensions. With no arguments, returns the scalar 0. With one positive integer, returns an n×n square; with two or more, builds an N-dimensional array. The optional last string argument selects the element type — 'int32', 'single', 'double', 'longdouble' — defaulting to the interpreter’s default precision.
Examples
Section titled “Examples”zeros(3) % 3×3 zeroszeros(2, 4) % 2×4 zeroszeros(2, 3, 'int32') % 2×3 int32 zeros