Mercurial > hg > octave-nkf
comparison src/data.cc @ 9329:67fc970dad7d
improve indexed assignment using indexed numel
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 10 Jun 2009 11:31:58 +0200 |
parents | 0d9178575dd7 |
children | c0b104835d0d |
comparison
equal
deleted
inserted
replaced
9328:0307f5e5568c | 9329:67fc970dad7d |
---|---|
2332 Returns the number of elements in the object @var{a}.\n\ | 2332 Returns the number of elements in the object @var{a}.\n\ |
2333 @seealso{size}\n\ | 2333 @seealso{size}\n\ |
2334 @end deftypefn") | 2334 @end deftypefn") |
2335 { | 2335 { |
2336 octave_value retval; | 2336 octave_value retval; |
2337 | 2337 octave_idx_type nargin = args.length (); |
2338 if (args.length () == 1) | 2338 |
2339 { | 2339 if (nargin >= 1) |
2340 int numel = args(0).numel (); | 2340 { |
2341 octave_idx_type numel = args(0).numel (args.slice (1, nargin-1)); | |
2341 | 2342 |
2342 if (! error_state) | 2343 if (! error_state) |
2343 { | |
2344 if (numel < 0) | |
2345 numel = 0; | |
2346 | |
2347 retval = numel; | 2344 retval = numel; |
2348 } | |
2349 } | 2345 } |
2350 else | 2346 else |
2351 print_usage (); | 2347 print_usage (); |
2352 | 2348 |
2353 return retval; | 2349 return retval; |