Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: numel or length, which is better?
Replies: 7   Last Post: Dec 14, 2014 9:29 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1
Registered: 9/12/07
Re: numel or length, which is better?
Posted: Apr 16, 2013 3:03 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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 (1-by-n, n-by-1)?
> 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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.