# HG changeset patch # User Jaroslav Hajek # Date 1259063949 -3600 # Node ID 5919f2bd9a996089918429e28cde85004fa0e539 # Parent 47c5af1868dfc0c7ead15f5a8f4e0f168f44f5d4 small improvements in accumarray diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-11-24 Jaroslav Hajek + + * general/accumarray.m: Use num2cell instead of mat2cell. Use repmat. + 2009-11-20 Jaroslav Hajek * script/miscellaneous/getfield: Deblank field names, gripe on invalid diff --git a/scripts/general/accumarray.m b/scripts/general/accumarray.m --- a/scripts/general/accumarray.m +++ b/scripts/general/accumarray.m @@ -105,7 +105,7 @@ endif ## Convert multidimensional subscripts. - subs = sub2ind (sz, mat2cell (subs, rows (subs), ones (1, ndims)){:}); + subs = sub2ind (sz, num2cell (subs, 1){:}); elseif (nargin < 3) ## In case of linear indexing, the fast built-in accumulator ## will determine the extent for us. @@ -145,7 +145,7 @@ [subs, idx] = sortrows (subs); if (isscalar (val)) - val = val * ones (size (idx)); + val = repmat (size (idx)); else val = val(idx); endif