[Top][All Lists]

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

Re: Get function arguments number

From: gianvito
Subject: Re: Get function arguments number
Date: Sun, 2 Jan 2011 02:34:27 -0800 (PST)

Thanks for you reply...
but args.length ( ) returns the number of the arguments passed to the C++ function ...

I need to know how many arguments does the function that i pass as argument accepts.
So, let's think I define a function in the octave prompt:
F = @(x,y) x + y;

Then I call the compiled C++ function:

well...I'd like to know in C++ how many arguments has the function F (in this case two).

So something as:
octave_function func = args(0).function_value();
func.arguments_number( );         // I need this function

Is this possible? Thanks

Il 02/01/2011 11:15, Jaroslav Hajek-2 [via Octave] ha scritto:
On Thu, Dec 30, 2010 at 6:46 PM, gianvito <[hidden email]> wrote:
> Hi all,
> I'm writing C++ code...I pass a function and get it using
> octave_function func = args(0).function_value();

Don't do this unless you really want, because this will ignore
function overloads. If you want to call the function, you should
simply do:
octave_value_list args = ....//prepare arguments
octave_value_list retval = args(0).do_multi_index_op(nargout, args);

> possible to know how many arguments does that function take in
> input? I searched for some function but haven't found anything...
> Thanks

Help-octave mailing list
[hidden email]

View message @
To unsubscribe from Get function arguments number, click here.

View this message in context: Re: Get function arguments number
Sent from the Octave - General mailing list archive at

reply via email to

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