help-octave
[Top][All Lists]
Advanced

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

Re: Need help with structures and "eval" function


From: John W. Eaton
Subject: Re: Need help with structures and "eval" function
Date: Wed, 22 Mar 2000 16:02:09 -0600 (CST)

On 22-Mar-2000, Thomas Walter <address@hidden> wrote:

| I'm interested too in how to do it.  To be more specific:
| 
| I have a sample function as m-file, but this can be any artificial
| function that's why to use an m-file for the definition.
| function y = myfunc (x, p)
|   # x : a value  and   p : a vector with parameters
|   y = p(1) * exp (- x / p(2));
| endfunction
| 
| Now the problem:  How to evaluate this function from within an .oct
| file?
| 
| I looked at 'parse.y' and some other files but I still have no idea
| how to do it.

  octave_value_list args;

  args(1) = p;
  args(0) = x;

  int nargout = 1;

  octave_value_list result = feval ("myfunc", args, nargout);

jwe



-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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