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


hesham
Posts:
1
Registered:
9/12/07


Re: numel or length, which is better?
Posted:
Apr 16, 2013 3:03 PM


A=magic(4) length(A) numel(A)
length calculate the number of column whereas numel calculate the number of element
"Jos (10584)" wrote in message <hkh28g$9mq$1@fred.mathworks.com>... > "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



