octave-maintainers
[Top][All Lists]
Advanced

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

Re: Running a script file inside c++ code


From: Mike Miller
Subject: Re: Running a script file inside c++ code
Date: Sat, 13 Aug 2016 15:29:42 -0700
User-agent: Mutt/1.6.2-neo (2016-07-23)

On Sat, Aug 13, 2016 at 00:18:57 -0700, sumeet kumar wrote:
> Hello all,
> 
> I am using octave parser to evaluate expression inside my c++ code. The
> expressions can be very simple can can also be complicated  depending upon
> the user.
> 
> 1)So basically, I have a string which contains all the commands that needs
> to be executed by octave. *But I am unable to execute and get the results
> of the string containing commands. *
> 
> 2)So, I found another way, in which I write the string in an file and then
> parse it using octave as
> 
>     char *oct_argv[3] =
> {(char*)"embeded",(char*)"-q",(char*)"--interactive"};
>     octave_main(3,oct_argv,true);
>     ofstream ScriptFile("script", ios::out);
>     ScriptFile << function ;
>     ScriptFile.close();
>     source_file("script");
> 
> where function is the string that needs to be evaluated.
> 
> The second approach works but the problem is very slow because of
> generation of file each time I want a computation. I usually end up in
> thousands/millions of them and it gets extremely slow, like taking days..
> to complete.
> 
> 
> In order to be more efficient, i want to do it as 1st way. So anybody has
> any idea, how to do it more faster/effecient or how to do as in first way.

Please show your code. What have you tried and why didn't it work?

-- 
mike



reply via email to

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