Skip to contents

Create a matrix of zeros of size (dim1 x dim2).

Usage

zeros(dim1, dim2 = NULL)

Arguments

dim1

The dimension of the matrix (if square) or the number of rows.

dim2

The number of columns

Value

A matrix of zeros.

See also

Other MATLAB: cell(), diag_matlab(), feval(), fileparts(), isempty(), ones(), rand(), randn(), size(), tic(), toc()

Examples


zeros(3)
#>      [,1] [,2] [,3]
#> [1,]    0    0    0
#> [2,]    0    0    0
#> [3,]    0    0    0
zeros(0,3)
#>      [,1] [,2] [,3]
zeros(4,7)
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,]    0    0    0    0    0    0    0
#> [2,]    0    0    0    0    0    0    0
#> [3,]    0    0    0    0    0    0    0
#> [4,]    0    0    0    0    0    0    0
zeros(1,4)
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    0    0    0