[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Use octave from C++ code
From: |
b0b |
Subject: |
Use octave from C++ code |
Date: |
Sat, 30 Apr 2011 00:50:59 -0700 (PDT) |
I am trying to use the Octave Control System Toolbox (OCST) from my own C++
code.
First, I searched for the control system functions (e.g. sysmult, tf, etc.)
if their equivalent functions in liboctave exists defined in the headers
(octave.h, etc.). But I couldnt find any except some Matrix functions.
Second, I wrote an Octave function ('pControlError') for doing my work and
tried to call it using 'feval'.
int main (const int argc, char ** argv)
{
const char * argvv [] = {"main", "-q"};
octave_main (2, (char **) argvv, true);
octave_value_list plant_tf, sysArgs;
Matrix plant_num(1,1), plant_den(1,2);
plant_num (0,0)= 1;
plant_den (0,0)= 1;
plant_den (0,1)= 1;
sysArgs (0) = 10;
sysArgs (1) = plant_num;
sysArgs (2) = plant_den;
const octave_value_list result = feval ("pControlError", sysArgs, 1);
std::cout << "result is " << result (0).scalar_value () << std::endl;
do_octave_atexit ();
return 0;
}
then compiled the code using:
>> mkoctfile --link-stand-alone main.cpp -o main
Now, while executing the code, i get the error that 'pControlError' is not
found:
error: feval: function `pControlError' not found
Whereas, I have copied the function pControlError into:
C:\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m
Also, if there were inbuilt function in liboctave for the OCST it would be
better as I need a fast code.--
View this message in context:
http://octave.1599824.n4.nabble.com/Use-octave-from-C-code-tp3485500p3485500.html
Sent from the Octave - General mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Use octave from C++ code,
b0b <=