# HG changeset patch # User John W. Eaton # Date 1294425418 18000 # Node ID 33f6384d2b78ff0a49b8b930f2c206cf53e1ff3e # Parent fbdb95640852bde308be3e758bc090cbc21ce433 cellfun compatibility fix diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2011-01-07 John W. Eaton + + * 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 + + * graphics.cc (Fget): Return empty matrix if no values are found. + Bug #32067. + 2011-01-06 Konstantinos Poulios * 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 - - * graphics.cc (Fget): Return empty matrix if no values are found. - Bug #32067. - 2011-01-06 John W. Eaton * DLD-FUNCTIONS/rand.cc (Frandperm): Tag call to floor with gnulib::. diff --git a/src/DLD-FUNCTIONS/cellfun.cc b/src/DLD-FUNCTIONS/cellfun.cc --- 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;