diff src/Cell.cc @ 5570:3074a549d644

[project @ 2005-12-08 21:01:50 by jwe]
author jwe
date Thu, 08 Dec 2005 21:01:50 +0000
parents b800ae36fc6a
children dfa2da0563e5
line wrap: on
line diff
--- a/src/Cell.cc	Thu Dec 08 16:57:31 2005 +0000
+++ b/src/Cell.cc	Thu Dec 08 21:01:50 2005 +0000
@@ -115,6 +115,31 @@
 }
 
 Cell
+Cell::column (octave_idx_type i) const
+{
+  Cell retval;
+
+  if (ndims () < 3)
+    {
+      if (i < 0 || i >= cols ())
+	error ("invalid column selection");
+      else
+	{
+	  octave_idx_type nr = rows ();
+
+	  retval.resize (dim_vector (nr, 1));
+
+	  for (octave_idx_type j = 0; j < nr; j++)
+	    retval.xelem (j) = elem (j, i);
+	}
+    }
+  else
+    error ("Cell::column: requires 2-d cell array");
+
+  return retval;
+}
+
+Cell
 Cell::concat (const Cell& rb, const Array<octave_idx_type>& ra_idx)
 {
   return insert (rb, ra_idx);