LENGTH Length of an Array
Section: Inspection Functions
Usage
Returns the length of an arrayx. The syntax for its use
is
y = length(x)
and is defined as the maximum length of x along any of its
dimensions, i.e., max(size(x)). If you want to determine the
number of elements in x, use the numel function instead.
Example
For a4 x 4 x 3 matrix, the length is 4, not 48, as you
might expect.
--> x = rand(4,4,3); --> length(x) ans = 4
