size.md (908B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function size 4 5 Calculate the size of a matrix or scalar. 6 7 8 ## Syntax 9 10 ```js 11 math.size(x) 12 ``` 13 14 ### Parameters 15 16 Parameter | Type | Description 17 --------- | ---- | ----------- 18 `x` | boolean | number | Complex | Unit | string | Array | Matrix | A matrix 19 20 ### Returns 21 22 Type | Description 23 ---- | ----------- 24 Array | Matrix | A vector with size of `x`. 25 26 27 ### Throws 28 29 Type | Description 30 ---- | ----------- 31 32 33 ## Examples 34 35 ```js 36 math.size(2.3) // returns [] 37 math.size('hello world') // returns [11] 38 39 const A = [[1, 2, 3], [4, 5, 6]] 40 math.size(A) // returns [2, 3] 41 math.size(math.range(1,6)) // returns [5] 42 ``` 43 44 45 ## See also 46 47 [count](count.md), 48 [resize](resize.md), 49 [squeeze](squeeze.md), 50 [subset](subset.md)