Mercurial > octave
diff src/DLD-FUNCTIONS/cellfun.cc @ 11457:33f6384d2b78
cellfun compatibility fix
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 07 Jan 2011 13:36:58 -0500 |
parents | 14993c9e857e |
children | fd0a3ac60b0e |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/cellfun.cc Fri Jan 07 12:52:46 2011 -0500 +++ b/src/DLD-FUNCTIONS/cellfun.cc Fri Jan 07 13:36:58 2011 -0500 @@ -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;