Problem running matlab in batch mode: Connection to X11 server lost, then runaway log file.

조회 수: 3 (최근 30일)

I am running MatLab 2010b on Ubuntu Linux.

Every time I run my batch script using matlab -r on the Linux command line, the script appears to run to completion, but then (in the log file, after all of the script output) I get the following error:

 Warning:
Connection to the X11 Display Server (:0.0) has been lost.
No more graphics windows can no longer be displayed in this session.
Graphics Objects can still be printed, and all commands should still work.
We recommend that you try to save your current session and exit 
> In run_sim_output_cbrn at 12
??? Operation terminated by user during ==> run_sim_output_cbrn at 12
 >> Invalid file descriptor
Invalid file descriptor
Invalid file descriptor
Invalid file descriptor
Invalid file descriptor
etc....

The phrase "Invalid file descriptor" is output continuously until my disk is full (creating an enormous log file).

At first I ran the script like this:

 > nohup matlab -nojvm -r batch_script.m -logfile batch.log &

Then I tried it again by putting the matlab command (matlab -nojvm -r batch_script.m -logfile batch.log) in a shell script called run_matlab_batch.cmd and then doing

 > nohup run_matlab_batch.cmd &

In both cases I end up with the same problem (nohup.out and batch.log grow with "Invalid file descriptor" until the disk gets full and the process crashes).

Thanks for any help on this one.

Aaron Schurger

답변 (2개)

Walter Roberson
Walter Roberson 2012년 1월 5일
Surround your code with a try/catch block (with no action in the catch), and follow it with quit
The try/catch ensures that the quit will be executed even if your program encounters a problem such as the "invalid file descriptor".
  댓글 수: 1
Aaron Schurger
Aaron Schurger 2012년 1월 5일
I should have mentioned that I already did precisely that, but to no avail. Same problem.
Any other suggestions?
Thanks, though.

댓글을 달려면 로그인하십시오.


Laurence Lurio
Laurence Lurio 2012년 6월 10일
Look at http://www.math.ufl.edu/help/matlab/tec1.1.html I think this is an alternative solution that worked for me (although I had to comment out the DISPLAY stuff)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by