matrix zeros

For filters.

Create a matrix filled with zeros.

Command Type

built-in

Signature

> matrix zeros {flags} (dimensions) ...rest

Parameters

  • dimensions: The dimensions of the zero matrix (e.g., 3 4 for a 3x4 matrix).
  • ...rest: Additional dimensions for n-dimensional arrays.

Input/output types:

input output
nothing matrix

Examples

Create a 3x4 matrix of zeros

> matrix zeros 3 4 | matrix into-nu | to nuon
[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]

Create a 2x2 matrix of zeros

> matrix zeros 2 2 | matrix into-nu | to nuon
[[0.0, 0.0], [0.0, 0.0]]

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.