#include #include #include #include #include #include int main() { // arguments for octave string_vector argv (2); argv(0) = "embedded"; argv(1) = "-q"; // quiet // start octave, run embedded (third parameter == true) octave_main (2, argv.c_str_vec (), true); // read the script file source_file("calc_and_plot.m"); // call the function with an argument octave_value_list in; in(0) = "Hello, world."; feval("calc_and_plot", in); std::cout << "octave (child process) done\n"; clean_up_and_exit(0); // quit octave. This also quits the program, // so use this together with atexit, if you // need to do something else after octave exits return 0; }