by

Terminal Command to Run a MATLAB Script in the Background

Use a terminal command like the following to runs a MATLAB script in the background under Linux, Mac OS X, etcetera.

 nohup matlab -nodisplay < runProgram.m > outputFile &

The nuhup command tells the OS to ignore hangups so the user who enters this command can log out and the program will still be running in the background. The -nodisplay option starts MATLAB without the GUI. The script to be run is called runProgram.m and any output generated by the script that would normally be displayed in the MATLAB command window will be written to a text file called outputFile. The & command tells the terminal to not wait for the program to finish executing before allowing the user to enter additional terminal commands.

You can use this command to run scripts on a machine to which you log on remotely.

Leave a Reply

Your email address will not be published.