help-octave
[Top][All Lists]
Advanced

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

passing global variables when embedding octave


From: Soeren Sonnenburg
Subject: passing global variables when embedding octave
Date: Mon, 02 Mar 2009 09:01:09 +0100

Dear all,

I've written a script to call python functions from within octave that
passes variables to python and results back to octave (avoiding disk
io). To this end I embedded python within octave context. (*)

Now I would like to do the same for python, i.e. run a octave function
from within python and pass all the variables to octave. So I need to
embed the octave interpreter. The octave_embed example (from
octave_embed.tar.gz ) shows how to run a script but not how to implant
global variables/access variables in either direction.

Could someone give an insight on how I can push a global variable to
octave and also get the variable back?

would be enough to show how 
octave_value x = octave_scalar(42);

is made visible in octave context and incremented +1 and result
transferred back...

Thanks a lot!
Soeren

(*) This will be in the shogun toolbox (http://www.shogun-toolbox.org),
currently things like

A=[[1,2,3];[4,5,6]];
B=[[1,1,1];[0,0,0]];
pythoncode=sprintf('import numpy\nresults=(A+B, 2*B, [ "bla1", "bla2" ])\n');
[A2,B2,bla]=elwms('run_python', 'A',A, 'B',B, 'pythoncode', pythoncode)

work.


reply via email to

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