UNPKG

1.03 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function concat
4
5Concatenate two or more matrices.
6
7
8## Syntax
9
10```js
11math.concat(A, B, C, ...)
12math.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
22Parameter | Type | Description
23--------- | ---- | -----------
24`args` | ... Array &#124; Matrix | Two or more matrices
25
26### Returns
27
28Type | Description
29---- | -----------
30Array &#124; Matrix | Concatenated matrix
31
32
33## Examples
34
35```js
36const A = [[1, 2], [5, 6]]
37const B = [[3, 4], [7, 8]]
38
39math.concat(A, B) // returns [[1, 2, 3, 4], [5, 6, 7, 8]]
40math.concat(A, B, 0) // returns [[1, 2], [5, 6], [3, 4], [7, 8]]
41math.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)