[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: 
Tue, 21 Mar 2000 02:51:26 0600 (CST) 
On 20Mar2000, A Scottedward Hodel <address@hidden> wrote:
 Gerrit Visser <address@hidden> wrote:
 >Is there some way I can either execute the "eval" command from a c++
 >(.oct) environment or to ask the octave session to evaluate it and return
 >a result? I've seen something like this in the Matlab .mex method, but
 >couldn't find anything usefull in the octave help. The source files for
 >octave isn't much help either, as I do not have a month to trace all the
 >classes / functions (probably a optimistic estimate of the time!)

 I think you're looking for the feval function; look in the helpoctave
 archives at http://www.che.wisc.edu/octave.
Or one of the eval functions. In the current sources, these are
defined in parse.y. In the 2.0.x sources, they are in toplev.cc.
 >The second problem I have is with passing structures to C++. Is there
 >somewhere in the help files I can find out how to handle them? The
 >reason I need it is the following: For a certain optimisation problem, the
 >cost function is a generic one. The cost function needs to call a function
 >specified in one of it's argument lists, so that it can call the correct
 >function for evaluation:

 I haven't used this .oct feature in awhile, so the syntax may be out of
 date, but here's a snippet of some code I used with the Octave controls
 toolbox a few years ago:
You can also look at the sources for the octave functions that work on
structures. The time.cc, getgrent.cc, getpwent.cc, and getrusage.cc
functions should give you some idea of how you can handle structures
inside a dynamically linked function.
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
