Mercurial > hg > octave-nkf
changeset 18187:f09abe022c96
cell2mat.m: Accept empty non-cell input for compatibility (bug #41010)
* cell2mat.m: Accept empty non-cell input for compatibility (bug #41010)
author | Felipe G. Nievinski <fgnievinski@gmail.com> |
---|---|
date | Fri, 27 Dec 2013 00:26:06 -0200 |
parents | 6e0686858b6a |
children | f24d5bd050d9 |
files | scripts/general/cell2mat.m |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/cell2mat.m +++ b/scripts/general/cell2mat.m @@ -32,15 +32,14 @@ print_usage (); endif - if (! iscell (c)) - error ("cell2mat: C is not a cell array"); - endif - nb = numel (c); if (nb == 0) m = []; else + if (! iscell (c)) + error ("cell2mat: C is not a cell array"); + endif ## Check first for valid matrix types valid = cellfun ("isnumeric", c); @@ -94,6 +93,7 @@ %! cell2mat (C) %!assert (cell2mat ({}), []); +%!assert (cell2mat ([]), []); %!test %! C = {[1], [2 3 4]; [5; 9], [6 7 8; 10 11 12]}; %! D = C; D(:,:,2) = C;