MATLAB: Question about length function

length

What does length(X) return if X is an nxm matrix?

Best Answer

length returns the maximum of n and m:
>> help length
length Length of vector.
length(X) returns the length of vector X. It is equivalent
to MAX(SIZE(X)) for non-empty arrays and 0 for empty ones.