Date: Apr 16, 2013 3:39 PM
Subject: Re: numel or length, which is better?
On 4/16/2013 2:16 PM, dpb wrote:
> On 4/16/2013 2:03 PM, Hesham Ismail wrote:
>> length calculate the number of column whereas numel calculate the number
>> of element
> Not necessarily...
> As noted in earlier response LENGTH() is max(size(x)) for any x whereas
> NUMEL() is prod(size(x))
> If one is interested in rows or columns (and often are) then have to ask
> for the size of the pertinent dimension to be certain....
And to belabor the point but to drive it home...
2 3 5
I've used utility functions on occasion for nrows and ncols as syntactic
sugar--they're trivial to write, of course--
% N = nrows(A) returns the number of rows, N, in array A.
% N = ncols(A) returns the number of cols, N, in array A.