Run Matlab GUI through ssh?

2019-02-27 07:27发布

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?

2条回答
霸刀☆藐视天下
2楼-- · 2019-02-27 08:02

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:

  1. 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).
  2. 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.

查看更多
Rolldiameter
3楼-- · 2019-02-27 08:14

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.

查看更多
登录 后发表回答