Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Jos
Posts:
1,268
Registered:
10/24/08


Re: numel or length, which is better?
Posted:
Feb 5, 2010 7:17 AM


"red " <828bwv@googlemail.com> wrote in message <hkh0jh$sdb$1@fred.mathworks.com>... > Which is correct/better usage for vectors (1byn, nby1)?
LENGTH is somewhat tricky since it returns the largest of the sizes in all dimensions. It can become nasty to debug errors when you supply matrices instead of vectors.
I always use NUMEL to find the number of elements, which is as clear as it can get.
Although I do not know the internal processes going on in LENGTH and NUMEL, I assume that LENGTH requires more internal steps.
hth Jos



