Octave+Qt+libsvm

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

Octave+Qt+libsvm

fingglep
SVM train not work, but work only with octave, without Qt.
I want work with octave+Qt+libsvm, how i can this? help please...

#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>

void runscript(const std::string &file)
{
    int parse_status = 0;
    // с выводом результата загрузки workspace
    //eval_string(file, false, parse_status);
    // без вывода результата загрузки workspace
    eval_string(file, false, parse_status, 0);
}

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);
    runscript("load EmulateData.mat;");
    SparseMatrix trainData = get_top_level_value("trainData", false).sparse_matrix_value();
    Matrix trainLabel = get_top_level_value("trainLabel", false).matrix_value();
    SparseMatrix testData = get_top_level_value("testData", false).sparse_matrix_value();
    Matrix testLabel = get_top_level_value("testLabel", false).matrix_value();
    octave_value_list in;
    in(0) = trainLabel;
    in(1) = trainData;
    in(2) = testLabel;
    in(3) = testData;
    octave_value_list result = feval("Emulate", in, 1);
    std::cout << "<= EXIT" << std::endl;
    return 0;
}


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