mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
51 lines
1.0 KiB
Markdown
51 lines
1.0 KiB
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
# Function concat
|
|
|
|
Concatenate two or more matrices.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.concat(A, B, C, ...)
|
|
math.concat(A, B, C, ..., dim)
|
|
```
|
|
|
|
### Where
|
|
|
|
- `dim: number` is 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
|
|
|
|
```js
|
|
var A = [[1, 2], [5, 6]];
|
|
var 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'
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[size](size.md),
|
|
[squeeze](squeeze.md),
|
|
[subset](subset.md),
|
|
[transpose](transpose.md)
|