<!-- 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


### Throws

Type | Description
---- | -----------


## 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)
