Mercurial > hg > octave-avbm
changeset 9859:5919f2bd9a99
small improvements in accumarray
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 24 Nov 2009 12:59:09 +0100 |
parents | 47c5af1868df |
children | c0d0b6e37a36 |
files | scripts/ChangeLog scripts/general/accumarray.m |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-11-24 Jaroslav Hajek <highegg@gmail.com> + + * general/accumarray.m: Use num2cell instead of mat2cell. Use repmat. + 2009-11-20 Jaroslav Hajek <highegg@gmail.com> * script/miscellaneous/getfield: Deblank field names, gripe on invalid
--- 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