The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 " <> wrote in message <hkh0jh$sdb$>...
> 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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.