help-octave
[Top][All Lists]
Advanced

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

Re: Stand alone problem: "dlmread" not found


From: David Grundberg
Subject: Re: Stand alone problem: "dlmread" not found
Date: Sun, 14 Mar 2010 14:44:37 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

TOMD111 skrev:
Hello,

I have a windows XP system and installed Octave with version 3.2.2.
Due to performance reasons, I tried to build a stand-alone file out of my
octave-function.

Well, in order to do that, you'd need to rewrite your m-files to C.

First I wrote a cpp file "call.cpp", which calls my m-file "Speed1.m":

#include #include #include #include #include /* do_octave_atexit */ #include #include

Strange include statements you got there.


int main (const int argc, char ** argv)
{
const char * argvv [] = {"" /* name of program, not relevant */, "--silent"};
   octave_main (2, (char **) argvv, true /* embedded */);
   const octave_value_list result = feval ("speed1");
   do_octave_atexit ();
}

I compiled this to "call.exe" with mkoctfile --link-stand-alone ...
"Speed1.m" looks like this:

tic();
for i=1:30
        input1 = dlmread(['test_daten.csv']);
        d1 = input1(:,2);
        d2 = input1(:,3);
        x=[2*d1>d2-1];       
        dlmwrite('test_daten_output.csv',x);
end
time_vec(1)=toc();
dlmwrite('time.txt',time_vec(1));

Running the "call.exe" file, the function "dlmread" cannot be found. Can
anybody help me to solve this problem? I tried to copy "call.exe" and "speed1.m" to the BIN-folder of the octave
installation folder. In this case it finds the function "dlmread" and works!

Thank you for your help,
Thomas.

The difference between a oct-file and a standalone is how to call them. You will need the liboctave/libcruft/libinterp libraries to run either kind. Windows has this weird thing going on where the it loads whatever libraries it can find in the same directory as the executable, so that's why copying to bin/ works.

You are not getting any performance enhancements from this, because the speed1.m is still being interpreted exactly as the octave executable does it. That's what feval does.

hth
David


reply via email to

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