# HG changeset patch # User Mike Miller # Date 1519258359 28800 # Node ID 8a26a4e649ba840a0dd8141854ceaa91eafe56fa # Parent 14b134ffdc242a64eb342fe434ed414278f3dd57 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. diff -r 14b134ffdc24 -r 8a26a4e649ba @pyobject/pyobject.m --- 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