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 max for filters

Find the maximum value in a matrix, or max along an axis.

Signature

> matrix max {flags}

Flags

  • --axis, -a {int}: The axis to find the max along (0-based).

Input/output types:

inputoutput
matrixfloat
matrixmatrix

Examples

Find the maximum element in a matrix

> [[1 2] [3 4]] | into matrix | matrix max
4.0

Find max along rows (axis 0)

> [[1 2] [3 4]] | into matrix | matrix max --axis 0 | matrix into-nu | to nuon
[[3.0, 4.0]]

Find max along columns (axis 1)

> [[1 2] [3 4]] | into matrix | matrix max --axis 1 | matrix into-nu | to nuon
[[2.0, 4.0]]