help-octave
[Top][All Lists]
Advanced

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

I have a problem with feval function of using c++ and octave


From: jessada2534
Subject: I have a problem with feval function of using c++ and octave
Date: Fri, 5 Apr 2013 11:09:03 -0700 (PDT)

after I collected and edited this code from somewhere, it could be compiled
but when run the function "feval" throws an exception like data out-of-bound
or something like that. here is the code

-------------------------------------------------------------------------------------
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>


using namespace std;

int main (const int argc, char **argv)
{
        const char *argvv[] = {"", "--silent"};

   octave_main(2, (char **)argvv, true);

   octave_idx_type n = 2;
   Matrix a_matrix = Matrix(1, 2);
   a_matrix(0) = 2;
   a_matrix(1) = 3;

   octave_value_list in = octave_value(a_matrix);
   octave_value_list out = feval("gg", in, 1);

   return 0;
}
------------------------------------------------------------------------------

and this is the m-file of gg.m file
-----------------------------------------------------------------------------
function [a] = gg(c)
   c = c+1;
   a = c;

endfunction
------------------------------------------------------------------------------

Did I do something wrong? or Is there another way to call m-file from c++
program

Thanks
Jess



--
View this message in context: 
http://octave.1599824.n4.nabble.com/I-have-a-problem-with-feval-function-of-using-c-and-octave-tp4651537.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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