(no subject)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

fingglep
I have a problem with set loaded variables from *.mat file for run external function from *.m file.

#include <QCoreApplication>
//
#include <iostream>
#include <string>
//
#include <oct.h>
#include <octave.h>
#include <parse.h>
#include <toplev.h>
#include <interpreter.h>
#include <builtin-defun-decls.h>
#include <Cell.h>
#include <Matrix.h>
#include <cmd-edit.h>
#include <cmd-hist.h>
#include <file-ops.h>
#include <file-stat.h>
#include <oct-env.h>
#include <oct-time.h>
#include <quit.h>
#include <comment-list.h>
#include <defaults.h>
#include <dirfns.h>
#include <dynamic-ld.h>
#include <error.h>
#include <input.h>
#include <lex.h>
#include <load-path.h>
#include <oct-hist.h>
#include <oct-map.h>
#include <ov-fcn-handle.h>
#include <ov-usr-fcn.h>
#include <ov-null-mat.h>
#include <toplev.h>
#include <pager.h>
#include <parse.h>
#include <pt-all.h>
#include <pt-eval.h>
#include <symtab.h>
#include <token.h>
#include <unwind-prot.h>
#include <utils.h>
#include <variables.h>

//------------------------------------------------------------
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    string_vector octave_argv (2);
    octave_argv(0) = "embedded";
    octave_argv(1) = "-q";
    octave::embedded_application app_oct(2, octave_argv.c_str_vec());
    app_oct.execute();
    load_fcn_from_file("Emulate.m", "", "", "", "Emulate", true);
    // source_file("Emulate.m");
    // call the function with an argument
    octave_value_list args;
    // MATLAB 6 (save -6 EmulateData.mat)
    args(0) = "EmulateData.mat";
    args(1) = "a";
    feval("load", args, 0);
    octave_value trainData = get_top_level_value("trainData", false);
    octave_value trainLabel = get_top_level_value("trainLabel", false);
    octave_value testData = get_top_level_value("testData", false);
    octave_value testLabel = get_top_level_value("testLabel", false);
    octave_value_list in;
    in(0) = trainData;
    in(2) = trainData;
    in(3) = trainData;
    in(4) = trainData;
    octave_value_list result = feval("Emulate");
    std::cout << "<= EXIT" << std::endl;
    clean_up_and_exit(0);
    return 0;
}

I need help....

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

siko1056
fingglep wrote
> I have a problem with set loaded variables from *.mat file for run
> external
> function from *.m file.
>
> [snip long code listing]
>
> I need help....

First, I assume you are trying to create an embedded Octave standalone
application [1], right?  Then, which version of Octave and operating system
do you use?  How did you try to compile your code (the exact command
including all linked libraries)?

Looking at some changesets on the development branch [2,3], I am not sure if
`octave::embedded_application` was ever intended to be released, so maybe
have a look at [1] again?  Where did you get this example from, or more
precise, which revision of the development branch are you working on?  Maybe
you should pull a more recent version?

Kai


[1]:
https://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html
[2]: https://hg.savannah.gnu.org/hgweb/octave/rev/c2c668b3051b
[3]: https://hg.savannah.gnu.org/hgweb/octave/rev/252975fdc444



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave