diff 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
line wrap: on
line diff
--- a/scripts/general/cell2mat.m
+++ b/scripts/general/cell2mat.m
@@ -43,9 +43,10 @@
   valid |= cellfun (@islogical, c);
   valid |= cellfun (@ischar, c);
   validc = cellfun (@iscell, c);
+  valids = cellfun (@isstruct, c);
 
-  if (! all (valid(:)) && ! all (validc(:)))
-    error ("cell2mat: wrong type elements or mixed cells and matrices");
+  if (! all (valid(:)) && ! all (validc(:)) && ! all (valids(:)))
+    error ("cell2mat: wrong type elements or mixed cells, structs and matrices");
   endif
 
   if (nb == 0)