[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is_real_matrix()

From: Stefan van der Walt
Subject: Re: is_real_matrix()
Date: Sat, 1 Oct 2005 18:50:40 +0200
User-agent: Mutt/1.5.9i

On Sat, Oct 01, 2005 at 05:59:46PM +0200, David Bateman wrote:
> The string class has the matrix_value() function and so can be converted 
> to a real matrix, it is therefore normal that it returns true for the 
> test for real matrices... You should test if its a string first, or use 
> something like

In 2.9.3, the following code shows that matrix_value() sets
error_state for strings.

#include <octave/oct.h>

DEFUN_DLD(checkm, args, nargout, "check real matrix")
   octave_value_list retval;
   if (args.length() != 1) {
      error("invalid nr of args");
      return retval;
   Matrix m = args(0).matrix_value();
   if (error_state) {
      error("input not a real matrix");
      return retval;

   return retval;


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]