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,268
Registered: 10/24/08
Re: numel or length, which is better?
Posted: Feb 5, 2010 7:17 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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.


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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.