Mercurial > pytave
changeset 426:8a26a4e649ba
pyobject.numel: delete, builtin numel is correct (fixes issue #88)
* @pyobject/pyobject.m: Delete numel, use the builtin numel to always
return 1 for Matlab compatibility.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 21 Feb 2018 16:12:39 -0800 |
parents | 14b134ffdc24 |
children | 750a86973625 |
files | @pyobject/pyobject.m |
diffstat | 1 files changed, 3 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/@pyobject/pyobject.m Fri May 05 15:55:41 2017 -0700 +++ b/@pyobject/pyobject.m Wed Feb 21 16:12:39 2018 -0800 @@ -225,13 +225,6 @@ varargout{nargout-1} = prod (sz(nargout:end)); endfunction - - function n = numel (x) - assert (nargin == 1) - sz = size (x); - n = prod (sz); - endfunction - function n = ndims (x) assert (nargin == 1) n = length (size (x)); @@ -241,7 +234,7 @@ assert (nargin == 3) assert (isscalar (index_pos)) if (num_indices == 1) - r = numel (x); + r = prod (size (x)); else r = size (x, index_pos); endif @@ -290,7 +283,7 @@ %! [a b c] = size (L); %! assert ([a b c], [1 3 1]) -%!assert (numel (pyeval ("[10, 20, 30]")), 3) +%!assert (numel (pyeval ("[10, 20, 30]")), 1) %!test %! L = pyeval ("[10, 20, 30]"); @@ -321,7 +314,7 @@ %!test %! [n m o p] = size (a); %! assert ([n m o p], [3 4 5 1]) -%!assert (numel (a), 60) +%!assert (numel (a), 1) %!assert (ndims (a), 3) %!shared