DIMENSION Function

DIMENSION (x ) ;

The DIMENSION function returns the dimensions of the x matrix. The total number of elements in a matrix is prod(dimension(x)).

The returned vector is a $1\times 2$ vector. The first element is the number of rows in x, and the second element is the number of columns, as shown in the following example:

x = {1 2, 3 4, 5 6};
d = dimension(x);
print d;

Figure 23.92: The Dimensions of a Matrix

d
3 2