help-octave
[Top][All Lists]
Advanced

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

Re: Octave engine: any update?


From: c.
Subject: Re: Octave engine: any update?
Date: Wed, 15 May 2013 13:42:23 +0200

On 15 May 2013, at 13:30, MrOba <address@hidden> wrote:

> This is not what I'm looking for..
> 
> mxCreateDoubleMatrix and mxGetPr are used inside a MEX files. The file is
> compiled WITH mkoctfile and the generated executable called FROM Octave..
> 
> What I need is different..
> I would like to start an instance of Octave (engOpen?), pass some data, do
> some calculation (engEvalString?), store the results and close Octave..
> 

Is there any particular reason you want Octave to run as a separate process?
Otherwise you can get the same behaviour by embedding Octave in your 
application, i.e.,
you can start the Octave interpreter by:

string_vector argv (1);
argv(0) = "embedded";
octave_main (1, argv.c_str_vec (), 1);

then you can call any Octave function in Octave using feval:

Matrix A;
ColumnVector b;
octave_value_list in;
in(1) = octave_value (b);
in(0) = octave_value (A);
octave_value_list out = feval ("mldivide", in, 1);

ColumnVector x = out(0).matrix_value ();

HTH,
c.


P.S. I have written this example off the top of my head and without testing, so 
it might contain errors, but you can find an example that works for sure in the 
file examples/embedded.cc inside Octave's source tree.




reply via email to

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