mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
1.0 KiB
1.0 KiB
Function concat
Concatenate two or more matrices.
Syntax
math.concat(A, B, C, ...)
math.concat(A, B, C, ..., dim)
Where
dim: numberis a zero-based dimension over which to concatenate the matrices. By default the last dimension of the matrices.
Parameters
| Parameter | Type | Description |
|---|---|---|
args |
... Array | Matrix | Two or more matrices |
Returns
| Type | Description |
|---|---|
| Array | Matrix | Concatenated matrix |
Examples
const A = [[1, 2], [5, 6]]
const B = [[3, 4], [7, 8]]
math.concat(A, B) // returns [[1, 2, 3, 4], [5, 6, 7, 8]]
math.concat(A, B, 0) // returns [[1, 2], [5, 6], [3, 4], [7, 8]]
math.concat('hello', ' ', 'world') // returns 'hello world'