diff liboctave/Array.cc @ 8527:6b074f37e8d7

reshape: improve error message
author John W. Eaton <jwe@octave.org>
date Thu, 15 Jan 2009 16:59:15 -0500
parents 17e0ad741fac
children 3a3421a9f0bb
line wrap: on
line diff
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -442,9 +442,14 @@
       if (dimensions.numel () == new_dims.numel ())
 	retval = Array<T> (*this, new_dims);
       else
-	(*current_liboctave_error_handler)
-	  ("reshape: size mismatch (%s != %s)", dimensions.str (),
-	   new_dims.str ());
+	{
+	  std::string dimensions_str = dimensions.str ();
+	  std::string new_dims_str = new_dims.str ();
+
+	  (*current_liboctave_error_handler)
+	    ("reshape: can't reshape %s array to %s array",
+	     dimensions_str.c_str (), new_dims_str.c_str ());
+	}
     }
   else
     retval = *this;