# HG changeset patch # User Jaroslav Hajek # Date 1259063949 -3600 # Node ID 5919f2bd9a996089918429e28cde85004fa0e539 # Parent 47c5af1868dfc0c7ead15f5a8f4e0f168f44f5d4 small improvements in accumarray diff -r 47c5af1868df -r 5919f2bd9a99 scripts/ChangeLog --- a/scripts/ChangeLog Tue Nov 24 12:30:26 2009 +0100 +++ b/scripts/ChangeLog Tue Nov 24 12:59:09 2009 +0100 @@ -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 -r 47c5af1868df -r 5919f2bd9a99 scripts/general/accumarray.m --- a/scripts/general/accumarray.m Tue Nov 24 12:30:26 2009 +0100 +++ b/scripts/general/accumarray.m Tue Nov 24 12:59:09 2009 +0100 @@ -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