help-octave
[Top][All Lists]
Advanced

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

How to convert octave_value to string?


From: Tamara Bechtold
Subject: How to convert octave_value to string?
Date: Wed, 03 Sep 2008 17:03:51 +0200
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

Dear all,
many thanks to your responses so far. Here is my code, that does not work properly:

DEFUN_DLD (name, args, ,"[Ar,Br,Cr,HSV] = name(A,B,C,r/tol,method,-equil,-job ") { //note the 4th argument can be either int (I call it r) or double (I call it tol) //and there should be difference if it is 1 or 1.0 as in each case different action should be performed
octave_value_list retval;
//now I want to read-in the arguments and try the following
int r=0;
double tol=0.0
if (args(3).is_integer_type())
{
r= args(3).int_value();
//call to function a(r)
}
if (args(3).is_double_type())
{
tol= args(3).double_value();
//call to funtion b(tol)
}
However the function .is_integer_type() gives always false and the function .is_double_type() always true. I think this is because all numerical data in Octave are written in double precision. In other words, this functions do not do what I want them to. Hence, I came to the conclusion, that the best would be to somehow turn the input arguments into strings and search if there is a dot in it.

Does anybody knows how?
Sincerely
Tamara


reply via email to

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