Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running matlab in the background

I am running matlab on 48 virtual machines and would like to automate it. I ssh into the machines then use matlab -r matlab_command > outfile.txt & to get the process to run in the background and run fine when I logout. The only problem is that when i jobs my process is stopped and won't start until I fg ^z bg. Is there a matlab flag so that I can run it in the background without having it stop?

Thanks, Mike

For clarification this is the order of commands that don't work

ssh server

matlab -r matlab_command > outfile.txt &

jobs

[1] Stopped

To fix this I

fg

^z

bg

logout

and it now works

like image 318
msandbot Avatar asked Jun 08 '10 19:06

msandbot


People also ask

Which processor is best for running MATLAB?

MATLAB supports the following processors: Any Intel or AMD x86-64 processor. AVX2 instruction set support is recommended. With Polyspace, 4 cores is recommended.


1 Answers

Use nohup command on UNIX to prevent MATLAB stop when you logout.

nohup matlab -nodisplay -nosplash -r matlab_command > outfile.txt &

And don't forget to include exit; at the end of matlab_command script.

UPDATE:

Try this solution: Is it possible to run MATLAB in the background under UNIX?

There is an explanation here.

like image 194
yuk Avatar answered Oct 03 '22 03:10

yuk