help-octave
[Top][All Lists]
Advanced

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

Re: is_real_matrix()


From: David Bateman
Subject: Re: is_real_matrix()
Date: Sat, 01 Oct 2005 17:59:46 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Søren Hauberg a écrit :

Hi,
In C++ (using 2.9.3), I've been using the 'is_real_matrix' function, but
don't get the results I expect. This code:

if (args.length() != 1 || !args(0).is_real_matrix()) {
   error("Input argument must be real matrix\n");
   return ret;
}
Matrix Dkm1 = args(0).matrix_value();

doesn't return an error if args(0) is a string. It does however give me
this error:

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

if (args.length() != 1 || args(0).type_name() != "matrix")

which will positively identify the type by it name as it appears in the "typeinfo" or "whos" command from the prompt..

Cheers
David

error: invalid conversion from string to real matrix

So how do I check if an input argument is a real matrix?

/Søren



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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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