| MATLAB Function Reference | Search  Help Desk |
| length | Examples See Also |
nThe statement=length(X)
length(X) is equivalent to max(size(X)) for nonempty arrays and 0 for empty arrays.
n = length(X)
returns the size of the longest dimension of X. If X is a vector, this is the same as its length.
x = ones(1,8);
n = length(x)
n =
8
x = rand(2,10,3);
n = length(x)
n =
10
ndims Number of array dimensions
size Array dimensions