Loading [Contrib]/a11y/accessibility-menu.js

zeros

Creates a matrix of zeros.

Syntax

M = zeros() returns 0.

M = zeros(n) returns an n by n matrix of zeros.

M = zeros(m, n) returns an m by n matrix of zeros.

M = zeros(d1, d2, ... dN) returns an N dimensional matrix of zeros.

M = zeros([d1, d2, ... dN]) returns an N dimensional matrix of zeros.

Inputs

m, n, d1, d2, dN, and so on.
The dimension inputs.
Type: integer
Dimension: scalar
A
Type: double | integer
Dimension: matrix

Outputs

M
A matrix of zeros.

Examples

Create a 2 by 3 matrix of zeros:

M = zeros([2,3]);
M = [Matrix] 2 x 3
0  0  0
0  0  0

Create a 2 by 2 by 2 matrix of zeros:

M = zeros(2,2,2);
M = 
slice(:, :, 1) = 
[Matrix] 2 x 2
0  0
0  0
slice(:, :, 2) = 
[Matrix] 2 x 2
0  0
0  0

Comments

zeros(size(A)) is convenient way to create a matrix of zeros with the same dimensions as another matrix.