Array dimensions
d = size(X)
[m,n] = size(X)
m = size(X,dim)
[d1,d2,d3,...,dn] = size(X),
d = size(X)
returns the
sizes of each dimension of array X
in a vector, d
,
with ndims(X)
elements.
If X
is a scalar, then size(X)
returns
the vector [1 1]
. Scalars are regarded as a 1by1
arrays in MATLAB^{®}.
If X
is a table, size(X)
returns
a twoelement row vector consisting of the number of rows and the
number of variables in the table. Variables in the table can have
multiple columns, but size
only counts the variables
and rows.
[m,n] = size(X)
returns
the size of matrix X
in separate variables m
and n
.
m = size(X,dim)
returns
the size of the dimension of X
specified by scalar dim
.
[d1,d2,d3,...,dn] = size(X),
for n
>
1, returns the sizes of the dimensions of the array X
in
the variables d1,d2,d3,...,dn, provided the number of output arguments n
equals ndims(X)
.
If n
does not equal ndims(X)
,
the following exceptions hold:




Note
For a Java array, 