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: Thomas Walter
Subject: Re: Need help with structures and "eval" function
Date: Thu, 23 Mar 2000 11:49:34 +0100

>>>>> "John" == John W Eaton <address@hidden> writes:

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

    John>   octave_value_list args;

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

    John>   int nargout = 1;

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

    John> jwe

Thanks!!!!
Looks easy, but sometimes I do not see the way to go.

Bye
Thomas

-- 
Warum hat eine Leiterbahn keine 90 Grad Winkel sondern 2 mal 45 Grad?
Weil die Elektronen sonst immer gegen die Wand laufen 8-)))

----------------------------------------------
Dipl. Phys. Thomas Walter
Inst. f. Physiklische Chemie II
Egerlandstr. 3                          Tel.: ++9131-85 27326 / 27330
91058 Erlangen, Germany                 email: address@hidden



-----------------------------------------------------------------------
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]