Mercurial > hg > octave-nkf
changeset 11457:33f6384d2b78
cellfun compatibility fix
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 07 Jan 2011 13:36:58 -0500 |
parents | fbdb95640852 |
children | 93a039fe681e |
files | src/ChangeLog src/DLD-FUNCTIONS/cellfun.cc |
diffstat | 2 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2011-01-07 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/cellfun.cc (Fcellfun): For uniformoutput case + with nargout > 0, initialize elements of retval to NDArray + objects of the same size as the input. Bug #32067. + +2011-01-07 John W. Eaton <jwe@octave.org> + + * graphics.cc (Fget): Return empty matrix if no values are found. + Bug #32067. + 2011-01-06 Konstantinos Poulios <logari81@googlemail.com> * txt-eng-ft.h, txt-eng-ft.cc: Remove dependency on graphics.h. @@ -28,11 +39,6 @@ (text::properties::renderer): New class member of type ft_render. (text::properties::pixels): New class member of type uint8NDArray. -2011-01-07 John W. Eaton <jwe@octave.org> - - * graphics.cc (Fget): Return empty matrix if no values are found. - Bug #32067. - 2011-01-06 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/rand.cc (Frandperm): Tag call to floor with gnulib::.
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -527,7 +527,12 @@ retval.resize (nargout1); for (int j = 0; j < nargout1; j++) - retval(j) = retv[j]; + { + if (nargout > 0 && retv[j].is_undefined ()) + retval(j) = NDArray (fdims); + else + retval(j) = retv[j]; + } } else { @@ -578,6 +583,16 @@ /* +%!test +%! [a,b] = cellfun (@(x) x, cell (2, 0)); +%! assert (a, zeros (2, 0)); +%! assert (b, zeros (2, 0)); + +%!test +%! [a,b] = cellfun (@(x) x, cell (2, 0), "uniformoutput", false); +%! assert (a, cell (2, 0)); +%! assert (b, cell (2, 0)); + %% Test function to check the "Errorhandler" option %!function [z] = cellfunerror (S, varargin) %! z = S;