Contents Previous Next Subchapters

Determining the Dimensions of a Matrix
Syntax size(x)
[mn] = size(x)
size(xd)
See Also rowdim , coldim

Description
Returns the number of rows and columns in the matrix x.

size(
x)
returns a two element integer row vector with the first element equal to the number of rows in x and the second element equal to the number of columns in x.

[
mn] = size(x)
sets the integer scalar m equal to the number of rows in x and the integer scalar n equal to the number of columns in x.

size(
xd)
If d is equal to one, returns an integer scalar equal to the number of rows in x. If d is equal to two, returns an integer scalar equal to the number of columns in x. The argument d must be an integer, real or double-precision scalar equal to one or two.

Example
If you enter
     size( rand(2, 3) )
O-Matrix will reply
     [ 2 , 3 ]