diff src/ov-cell.cc @ 4610:02d2fcf835fc

[project @ 2003-11-14 17:08:59 by jwe]
author jwe
date Fri, 14 Nov 2003 17:08:59 +0000
parents cba347c642e2
children d44675070f1a
line wrap: on
line diff
--- a/src/ov-cell.cc
+++ b/src/ov-cell.cc
@@ -506,6 +506,46 @@
   return retval;
 }
 
+DEFUN (iscellstr, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} iscellstr (@var{cell})\n\
+Return true if every element of the cell array @var{cell} is a\n\
+character string\n\
+@end deftypefn")
+{
+  octave_value retval = true;
+
+  if (args.length () == 1)
+    {
+      octave_value arg = args (0);
+
+      if (arg.is_cell ())
+	{
+	  Cell c = args(0).cell_value ();
+
+	  if (! error_state)
+	    {
+	      for (int i = 0; i < c.length (); i++)
+		{
+		  if (! c(i).is_string ())
+		    {
+		      retval = false;
+		      break;
+		    }
+		}
+	    }
+	  else
+	    error ("iscellstr: expecting argument to be a cell");
+	}
+      else
+	retval = false;
+    }
+  else
+    print_usage ("iscellstr");
+
+  return retval;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***