5.6) Basic Array Information
A number of useful functions provide information on arrays.
- size - Returns the length of each dimension of an array, as a row vector
- length - Returns the length of the longest dimension of an array
- ndims - Returns the number of dimensions of an array
- numel - Returns the number of elements in an array. For example, if an array has dimensions AxBxC, then numel will return the product ABC
- isempty - Returns 1 (true) if the array is empty
- isequal - Returns 1 (true) if the two input arrays are equal (in both size and cell values)
Syntax: d=size(A) or [x y]=size(A) or [x y z]=size(A), etc. If "A" is a scalar then size(A) gives a 1x1 vector
Syntax: d=length(A), where "d" is a scalar
Syntax: d=ndims(A), where "d" is a scalar
Syntax: d=numel(A), where "d" is a scalar
Syntax: d=isempty(A), where "d" is logical (0 or 1)
Syntax: d=isequal(A,B), where "d" is a logical (0 or 1)