ResearchBlog‎ > ‎

[Misc] C++ integration of Octave

posted Oct 4, 2011, 2:05 PM by Teng-Yok Lee
According to Wiki:

It is also possible to execute Octave code directly in a C++ program. For example, here is a code snippet for calling rand([10,1]):

  #include <octave/oct.h>
  ...
  ColumnVector NumRands(2);
  NumRands(0) = 10;
  NumRands(1) = 1;
  octave_value_list f_arg, f_ret;
  f_arg(0) = octave_value(NumRands);
  f_ret = feval("rand",f_arg,1);
  Matrix unis(f_ret(0).matrix_value());

This might be useful to us. Some related reference are below:

  1. Octave C++ API. http://octave.sourceforge.net/doxygen/html/
  2. Howto Use Octave Functions in C/C++ Programs. http://www.mathias-michel.de/download/howto-octave-c++.ps (local minor of the .pdf version).

Ċ
Teng-Yok Lee,
Oct 4, 2011, 2:05 PM
Comments