Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

matrix set-row for filters

Replace a row in a matrix.

Signature

> matrix set-row {flags} (index) (replacement)

Parameters

  • index: The row index to replace (0-based).
  • replacement: The new row values as a list of numbers.

Input/output types:

inputoutput
matrixmatrix

Examples

Replace the first row of a 2x3 matrix

> matrix zeros 2 3 | matrix set-row 0 [1.0 2.0 3.0] | matrix into-nu | to nuon
[[1.0, 2.0, 3.0], [0.0, 0.0, 0.0]]

Replace the second row of a 2x2 matrix

> matrix zeros 2 2 | matrix set-row 1 [4.0 5.0] | matrix into-nu | to nuon
[[0.0, 0.0], [4.0, 5.0]]