[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
eval and feval for reusable functions
From: |
John Utz |
Subject: |
eval and feval for reusable functions |
Date: |
Tue, 29 Oct 1996 10:43:49 -0800 (PST) |
Hello;
On Tue, 29 Oct 1996, Bernt Nilsson wrote:
> Hello all,
>
> Is there a way to send parameters to FSOLVE like there is in MATLAB (i.e.
> fsolve('func',...,p1,p2,p3...))?
>
Umm, this is not as specific an answer as i would like to give, but is has
been about a year since i last had to do this and i dont have any examples
in front of me...
the technique for making functions that take arguments requires
using the eval() command. Unfortuneately, the help eval entry is
profoundly terse :-) :
*octave:1> help eval
* eval is a builtin function
*eval (TRY, CATCH)
*Evaluate the string TRY as octave code. If that fails, evaluate the
*string CATCH.
but help -i eval brings up a really good discussion of how to use eval and
feval.
generally, one passes in a string or two, parses same using the octave
string commands and evals or fevals the resultant bits.
there is a bit of overhead in figuring out how to do this the first
time, but once one gets the hang of it it is a great facilitator of
reusable code.
> Bernt J Nilsson email : address@hidden
> FOA, Inst. 65 tel : +46 8 706 3611
> S-172 90 Stockholm, Sweden FAX : +46 8 706 3543
good luck!
*******************************************************************************
John Utz address@hidden
idiocy is the impulse function in the convolution of life