Mercurial > hg > octave-lyh
comparison scripts/general/cell2mat.m @ 10863:5a55773fcaa9
allow structs in cell2mat
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 06 Aug 2010 14:22:48 +0200 |
parents | ca2df6737d6b |
children | b1f4bdc276b6 |
comparison
equal
deleted
inserted
replaced
10862:337db4e1342d | 10863:5a55773fcaa9 |
---|---|
41 ## We only want numeric, logical, and char matrices. | 41 ## We only want numeric, logical, and char matrices. |
42 valid = cellfun (@isnumeric, c); | 42 valid = cellfun (@isnumeric, c); |
43 valid |= cellfun (@islogical, c); | 43 valid |= cellfun (@islogical, c); |
44 valid |= cellfun (@ischar, c); | 44 valid |= cellfun (@ischar, c); |
45 validc = cellfun (@iscell, c); | 45 validc = cellfun (@iscell, c); |
46 valids = cellfun (@isstruct, c); | |
46 | 47 |
47 if (! all (valid(:)) && ! all (validc(:))) | 48 if (! all (valid(:)) && ! all (validc(:)) && ! all (valids(:))) |
48 error ("cell2mat: wrong type elements or mixed cells and matrices"); | 49 error ("cell2mat: wrong type elements or mixed cells, structs and matrices"); |
49 endif | 50 endif |
50 | 51 |
51 if (nb == 0) | 52 if (nb == 0) |
52 m = []; | 53 m = []; |
53 else | 54 else |