Function size

Calculate the size of a matrix or scalar.

Syntax

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.

Examples

size(2.3);                  // returns []
size('hello world');        // returns [11]

var A = [[1, 2, 3], [4, 5, 6]];
size(A);                    // returns [2, 3]
size(range(1,6));      // returns [5]

See also

resize, squeeze, subset