[Top][All Lists]

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

my c/c++ "octaveserver" program does not work with inbuilit m-file funct

From: maber
Subject: my c/c++ "octaveserver" program does not work with inbuilit m-file functions
Date: Wed, 3 Dec 2014 06:45:38 -0800 (PST)

I have recompiled octave to an "octaveserver" using Visual Studio 2013. This
enables me to call octave m-files from a client c/c++ program using a pipe.
This works very fine for common math operators like +,-,/,* in my m-files.
However when I like to call those simple inbuilt m-file functions like
trapz, polyfit.. etc, the "octaveserver" does not provide correct answers.
Somehow,  my octaveserver cannot "link" those inbuilt functions properly.
Have I missed something in the compilation?

My simple octaveserver function which can analyse spectral data looks as

#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/toplev.h>

const octave_value_list Predictor(std::string mfile, double spectrum[], int
        // Insert spectrum into octave matrix type
        Matrix sz(1, spectrumsize);
        for (int j = 0; j < spectrumsize; j++)
                sz(0, j) = spectrum[j];
        octave_value_list in;
        in(0) = octave_value(sz);
        //Start octave
        const char * argvv[] = { "" /* name of program, not relevant */, 
        octave_main(2, (char **)argvv, true /* embedded */);
        //Evaluate and return the result 
        const octave_value_list result = feval(mfile, in, 1);

        return result;

I would appreciate any hint in this!! Thanks, 

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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