[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:54:19 -0800 (PST)

Eheh right...
but I'd like to accept only function with 2 arguments as input and raise an error when the function has a different number of arguments
or a variable numbers of arguments...

isn't possible at all to do this check?


Il 02/01/2011 11:48, Søren Hauberg [via Octave] ha scritto:
søn, 02 01 2011 kl. 02:34 -0800, skrev gianvito:

> 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:
> testCfunction(F);
> 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

In general no. Think of the following function

  function retval = count_num_inputs (varargin)
    retval = numel (varargin);

How many arguments does this function accept?


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]