2022-10-11 12:18:47 +02:00

51 lines
1.2 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-flatten">Function flatten <a href="#function-flatten" title="Permalink">#</a></h1>
Flatten a multidimensional matrix into a single dimensional matrix.
A new matrix is returned, the original matrix is left untouched.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.flatten(x)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | Matrix &#124; Array | Matrix to be flattened
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
Matrix &#124; Array | Returns the flattened matrix
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4]
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[concat](concat.html),
[resize](resize.html),
[size](size.html),
[squeeze](squeeze.html)