1 |
|
2 |
|
3 | # Function concat
|
4 |
|
5 | Concatenate two or more matrices.
|
6 |
|
7 |
|
8 | ## Syntax
|
9 |
|
10 | ```js
|
11 | math.concat(A, B, C, ...)
|
12 | math.concat(A, B, C, ..., dim)
|
13 | ```
|
14 |
|
15 | ### Where
|
16 |
|
17 | - `dim: number` is a zero-based dimension over which to concatenate the matrices.
|
18 | By default the last dimension of the matrices.
|
19 |
|
20 | ### Parameters
|
21 |
|
22 | Parameter | Type | Description
|
23 | --------- | ---- | -----------
|
24 | `args` | ... Array | Matrix | Two or more matrices
|
25 |
|
26 | ### Returns
|
27 |
|
28 | Type | Description
|
29 | ---- | -----------
|
30 | Array | Matrix | Concatenated matrix
|
31 |
|
32 |
|
33 | ## Examples
|
34 |
|
35 | ```js
|
36 | const A = [[1, 2], [5, 6]]
|
37 | const B = [[3, 4], [7, 8]]
|
38 |
|
39 | math.concat(A, B) // returns [[1, 2, 3, 4], [5, 6, 7, 8]]
|
40 | math.concat(A, B, 0) // returns [[1, 2], [5, 6], [3, 4], [7, 8]]
|
41 | math.concat('hello', ' ', 'world') // returns 'hello world'
|
42 | ```
|
43 |
|
44 |
|
45 | ## See also
|
46 |
|
47 | [size](size.md),
|
48 | [squeeze](squeeze.md),
|
49 | [subset](subset.md),
|
50 | [transpose](transpose.md)
|