51 lines
908 B
Markdown
51 lines
908 B
Markdown
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
||
|
|
||
|
# Function size
|
||
|
|
||
|
Calculate the size of a matrix or scalar.
|
||
|
|
||
|
|
||
|
## Syntax
|
||
|
|
||
|
```js
|
||
|
math.size(x)
|
||
|
```
|
||
|
|
||
|
### Parameters
|
||
|
|
||
|
Parameter | Type | Description
|
||
|
--------- | ---- | -----------
|
||
|
`x` | boolean | number | Complex | Unit | string | Array | Matrix | A matrix
|
||
|
|
||
|
### Returns
|
||
|
|
||
|
Type | Description
|
||
|
---- | -----------
|
||
|
Array | Matrix | A vector with size of `x`.
|
||
|
|
||
|
|
||
|
### Throws
|
||
|
|
||
|
Type | Description
|
||
|
---- | -----------
|
||
|
|
||
|
|
||
|
## Examples
|
||
|
|
||
|
```js
|
||
|
math.size(2.3) // returns []
|
||
|
math.size('hello world') // returns [11]
|
||
|
|
||
|
const A = [[1, 2, 3], [4, 5, 6]]
|
||
|
math.size(A) // returns [2, 3]
|
||
|
math.size(math.range(1,6)) // returns [5]
|
||
|
```
|
||
|
|
||
|
|
||
|
## See also
|
||
|
|
||
|
[count](count.md),
|
||
|
[resize](resize.md),
|
||
|
[squeeze](squeeze.md),
|
||
|
[subset](subset.md)
|