PDA

View Full Version : Launch octave from Qt



Nick_Neo
11th June 2015, 12:12
Is there any way to launch octave using Qt with a button click?
I tried this

QProcess p;
p.start("/usr/bin/octave");
p.waitForFinished(-1);
But it didn't work. Nothing is being displayed.
Any kind of help is appreciated.... Thanks in advance

d_stranz
11th June 2015, 19:14
QProcess emits one of two signals (started() or error()). You aren't connecting to either of those, so how do you know that the octave process is actually started successfully?

Nick_Neo
12th June 2015, 08:09
I figured out this...

void MainWindow::on_pushButton_clicked()
{
QString filename = "/home/ubuntu/Documents/MATLAB/test.m";
QProcess *p = new QProcess(this);
QString app = "gnome-terminal -e octave";
QStringList arguments;
arguments << QString ("run('%1')".arg(filename));
p->start(app,arguments);
}


With the above code in Ubuntu, I'm able to launch octave, but test.m file is not being run. Kindly help me

Lesiok
12th June 2015, 08:26
But this code is : run a program called gnome-terminal -e octave with one argument run(/home/ubuntu/Documents/MATLAB/test.m).
In other words command line is : "gnome-terminal -e octave" run(/home/ubuntu/Documents/MATLAB/test.m)

Nick_Neo
12th June 2015, 10:03
in terminal, if only
octave /home/ubuntu/Documents/MATLAB/test.m
is clicked, my test file is being run. How can I do that through Qt?