help-octave
[Top][All Lists]
Advanced

[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)

Hi! 
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
follows


#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
spectrumsize)  
{
        // 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 */, 
"--silent"
};
        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, 
Mads



--
View this message in context: 
http://octave.1599824.n4.nabble.com/my-c-c-octaveserver-program-does-not-work-with-inbuilit-m-file-functions-tp4667657.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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