SIZE

Purpose:

Returns a 2 point series containing the dimensions of an array.

Syntax:

SIZE(a, n)

(nrows, ncols) = SIZE(a)

a

-

An input series or array

n

-

Optional. An integer, the dimension to return:

1:

return NUMROWS

2:

return NUMCOLS

If n is unspecified, SIZE returns the 2 point series {numrows, numcols}.

Returns:

A series of 2 values, the number of rows and the number of columns.

 

(nrows, ncols) = size(a) returns the number of rows and columns in separate variables.

Example:

a = 1..10;

s = size(a);

 

s == {10, 1}

Example:

b = ravel(a, a);

size(b);

 

displays the string 10x2 since the result from SIZE was not assigned.

Example:

SIZE also supports multiple return values:

 

(nr, nc) = size(b)

 

nr == 10

nc == 2

Example:

W1: rand(10, 3)

size

 

Displays 10x3 in the status area.

Remarks:

SIZE returns the series {1, 1} for scalar inputs.

 

SIZE with no arguments displays the size of the current Window in the status area.

 

If the output from SIZE is not assigned, the size of the input is displayed as a string. To return the size as a series and place it in the current Window, use:

 

{size(x)}

See Also:

LENGTH

NUMCOLS

NUMEL

NUMROWS