concat.md (1079B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 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 ### Throws 34 35 Type | Description 36 ---- | ----------- 37 38 39 ## Examples 40 41 ```js 42 const A = [[1, 2], [5, 6]] 43 const B = [[3, 4], [7, 8]] 44 45 math.concat(A, B) // returns [[1, 2, 3, 4], [5, 6, 7, 8]] 46 math.concat(A, B, 0) // returns [[1, 2], [5, 6], [3, 4], [7, 8]] 47 math.concat('hello', ' ', 'world') // returns 'hello world' 48 ``` 49 50 51 ## See also 52 53 [size](size.md), 54 [squeeze](squeeze.md), 55 [subset](subset.md), 56 [transpose](transpose.md)