I am trying to run the MATLAB through ssh on a remote cluster. When i type matlab in the terminal it just opens the MATLAB command line in the terminal environment. My question is there any way that i can have access to the MATLAB GUI as well?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes you can get the GUI to show up. You need (i) an X-windows system running on your local machine and (ii) to use the -X option for ssh to enable X11 forwarding. More detailed answer:
- From your local terminal, check the the DISPLAY environmental variable is set. Eg. from the terminal on my mac:
echo $DISPLAY
returns/private/tmp/com.apple.launchd.y9pXfRNnTu/org.macosforge.xquartz:0
If DISPLAY environmental variable isn't set, you probably need to get an X-server properly installed (eg. for Mac OS X it is X11.app). - When you login to the remote machine using ssh, use the -X option to enable X11 forwarding. Eg. from your local terminal type:
ssh -X username@remotehost.com
where username and remotehost are your username and the remote host name respectively. With the -X option, SSH will make it all magically work: ssh will set the DISPLAY environmental variable on the remote machine to a port ssh is listening to and channel the graphics data back to back to the address in your local DISPLAY environmental variable, which should point to your local X-server.
Btw, unless you're RIGHT next to the cluster networking wise, this is likely to be !@#$!@#$ slow & annoying. If you're a student, I'd highly recommend ponying up and getting a student edition of Matlab so you can run the GUI locally. Student version isn't that expensive.
回答2:
You can not only with SSH. You may be interested in VNC. But, do you absolutely need a GUI?
Moreover, what about using MATLAB on your own computer? If it is a license problem, you should give a try to GNU Octave that is free/libre, gratis and cross-platform.