octave-maintainers
[Top][All Lists]
Advanced

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

Running a script file inside c++ code


From: sumeet kumar
Subject: Running a script file inside c++ code
Date: Sat, 13 Aug 2016 00:18:57 -0700

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.

Sumeet

--
         
Sumeet Kumar Sinha
Graduate Student
Phone: (+1) 5306018271

reply via email to

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