UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

41 lines (25 loc) 722 B
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # Function flatten Flatten a multi dimensional matrix into a single dimensional matrix. It is guaranteed to always return a clone of the argument. ## Syntax ```js math.flatten(x) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `x` | Matrix &#124; Array | Matrix to be flattened ### Returns Type | Description ---- | ----------- Matrix &#124; Array | Returns the flattened matrix ## Examples ```js math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4] ``` ## See also [concat](concat.md), [resize](resize.md), [size](size.md), [squeeze](squeeze.md)