1 |
|
2 |
|
3 | # Function flatten
|
4 |
|
5 | Flatten a multi dimensional matrix into a single dimensional matrix.
|
6 | It is guaranteed to always return a clone of the argument.
|
7 |
|
8 |
|
9 | ## Syntax
|
10 |
|
11 | ```js
|
12 | math.flatten(x)
|
13 | ```
|
14 |
|
15 | ### Parameters
|
16 |
|
17 | Parameter | Type | Description
|
18 | --------- | ---- | -----------
|
19 | `x` | Matrix | Array | Matrix to be flattened
|
20 |
|
21 | ### Returns
|
22 |
|
23 | Type | Description
|
24 | ---- | -----------
|
25 | Matrix | Array | Returns the flattened matrix
|
26 |
|
27 |
|
28 | ## Examples
|
29 |
|
30 | ```js
|
31 | math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4]
|
32 | ```
|
33 |
|
34 |
|
35 | ## See also
|
36 |
|
37 | [concat](concat.md),
|
38 | [resize](resize.md),
|
39 | [size](size.md),
|
40 | [squeeze](squeeze.md)
|