help-octave
[Top][All Lists]
Advanced

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

Re: Get function arguments number


From: Søren Hauberg
Subject: Re: Get function arguments number
Date: Sun, 02 Jan 2011 11:47:13 +0100

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);
  endfunction

How many arguments does this function accept?

Søren




reply via email to

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