matrix transpose

For filters.

Transpose a matrix (swap rows and columns). For n-dimensional arrays, reverses all axes.

Command Type

built-in

Signature

> matrix transpose {flags}

Input/output types:

input output
matrix matrix

Examples

Transpose a 2x3 matrix to a 3x2 matrix

> [[1 2 3] [4 5 6]] | into matrix | matrix transpose | matrix into-nu | to nuon
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]

Transpose an identity matrix (result is the same)

> matrix identity 2 | matrix transpose | matrix into-nu | to nuon
[[1.0, 0.0], [0.0, 1.0]]

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