Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch Linux terminal from Matlab

Tags:

linux

matlab

I want to launch a Linux terminal from a Matlab script in order to run an object file from the terminal. After launching the terminal the Matlab script has to continue.

I have tried both the unix() and system() commands, but in both the Matlab script gets stuck in the terminal script and doesn't continue.

Is there a way for a Matlab script to launch a terminal, run an executable file on it and have the Matlab script continue with the rest of the script?

like image 980
user2835098 Avatar asked Feb 22 '26 07:02

user2835098


2 Answers

To return to Matlab immediately after starting the external process, add & at the end of the string passed to system. For example

system('filename &')
like image 57
Luis Mendo Avatar answered Feb 25 '26 00:02

Luis Mendo


You'll want to launch a separate terminal application such as terminal, gnome-terminal, xterm, konsole, etc (see here) providing the -e flag followed by the command you want to run. Something like this:

system('gnome-terminal -e ''your command here'' &')
like image 37
MasterHD Avatar answered Feb 25 '26 02:02

MasterHD