diff src/pt-cell.cc @ 4501:693ad5220d1e

[project @ 2003-09-05 20:55:40 by jwe]
author jwe
date Fri, 05 Sep 2003 20:55:40 +0000
parents ccfdb55c8156
children e35b034d3523
line wrap: on
line diff
--- a/src/pt-cell.cc
+++ b/src/pt-cell.cc
@@ -53,20 +53,7 @@
   int nr = length ();
   int nc = -1;
 
-  for (iterator p = begin (); p != end (); p++)
-    {
-      tree_argument_list *elt = *p;
-
-      if (nc < 0)
-	nc = elt->length ();
-      else if (nc != static_cast<int> (elt->length ()))
-	{
-	  ::error ("number of columns must match");
-	  return retval;
-	}
-    }
-
-  Cell val (nr, nc);
+  Cell val;
 
   int i = 0;
 
@@ -76,6 +63,23 @@
 
       octave_value_list row = elt->convert_to_const_vector ();
       
+      if (nc < 0)
+	{
+	  nc = row.length ();
+
+	  val = Cell (nr, nc);
+	}
+      else
+	{
+	  int this_nc = row.length ();
+
+	  if (nc != this_nc)
+	    {
+	      ::error ("number of columns must match");
+	      return retval;
+	    }
+	}
+
       for (int j = 0; j < nc; j++)
 	val(i,j) = row(j);