MATLAB: Close the terminal but keep matlab running on a remote Ubuntu

remotely running matlab

hi Folks:
I don't have much experience running Matlab remotely, so please forgive me if you think my question is dumb.
I am running Matlab on a remote Ubuntu from my laptop. My Matlab program takes hours, or even days to run. So the best way is to let it run on the remote Ubuntu even if I logout my connection with it.
I was told screen command can do that. So here is what I did:
1. Connect to the remote Ubuntu using butty, initiate a new screen session, and start Matlab.
2. Let the Matlab scrip run. (when Matlab script is running, its interface is shown on my laptop)
3. Detach, and then logout the screen session.
4. Close butty (of course, the Matlab windows on my laptop were also gone)
5. Reconnect to the remote Ubuntu, and re-attach the screen session.
But, no Matlab was running!
So, how do I run my Matlab script on that remote Ubuntu with my connection to that server is closed?
Thanks a lot. Any suggestion is appreciated.

Best Answer

I think when you log out of the screen session, you are killing MATLAB. Here's a worked example:
% screen -ls


No Sockets found in /var/run/screen/S-myusername.
% screen
% screen -ls
There is a screen on:
24084.pts-1.hostname (03/05/12 13:39:28)
(Attached)
1 Socket in /var/run/screen/S-myusername.
% matlab
Now I detach (control-a control-d). I can verify that MATLAB is still running with "ps". I exit from the terminal, then establish a new connection.
% screen -ls
There is a screen on:
24084.pts-1.myhostname (03/05/12 13:39:28)
(Detached)
% screen -r 24084.pts-1.myhostname
Now I'm back in MATLAB.