changeset 10863:5a55773fcaa9

allow structs in cell2mat
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 06 Aug 2010 14:22:48 +0200
parents 337db4e1342d
children d19d2abdd65f
files scripts/ChangeLog scripts/general/cell2mat.m
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Aug 05 20:28:16 2010 -0400
+++ b/scripts/ChangeLog	Fri Aug 06 14:22:48 2010 +0200
@@ -1,3 +1,7 @@
+2010-08-06  Jaroslav Hajek  <highegg@gmail.com>
+
+	* general/cell2mat.m: Allow cells of struct arrays.
+
 2010-08-05  Ben Abbott <bpabbott@mac.com>
 
 	* /plot/__print_parse_opts__.m, plot/__fltk_print__.m: Don't warn on
--- a/scripts/general/cell2mat.m	Thu Aug 05 20:28:16 2010 -0400
+++ b/scripts/general/cell2mat.m	Fri Aug 06 14:22:48 2010 +0200
@@ -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)