Using external C++ functions from Octave

Tamara Bechtold tamara.bechtold at gmail.com
Tue Sep 2 09:57:57 CDT 2008


Dear all,

I am trying to read in aggument in Octave and pass them to a C++ 
function to be compiled. I want to read-in a single argument which can 
be either double or int, say the user gives 1 or 1.0. Within the c++ 
function I am trying to check what kind of argument was passed by the 
user with following code:
int m;
double n;
if (args(3).is_scalar_type())
 m = args(3).int_value();
if (args(3).is_double_type())
 n= args(3).double_value();
But it does not work. In other word when I pass 10.0 both variables, m 
and n are initialized with 10! I want only n to get the value 10.0. How 
can this be done? Can enybody help?
Many thanks in advance.
Tamara


More information about the Help-octave mailing list