remotely connect to Matlab

Prepare two machines. In my case:

  • remote machine (ubuntu 13.04 x64)
  • local machine ( macbook air with Mac OS X 10.8 )

Basic Setup

  1.  Install Matlab application to Ubuntu Desktop.
  2.  By typing the following command in the terminal on the Mac, Matlab would be started in client-side.

ssh -X REMOTE-HOST “matlab -desktop”

Speed Up

Using the default setting would produce  poor performance if it is over 3G connection. Thus, it is recommended to apply the following optimization.

  • Switch to server-side and then create a file call java.opts  with a statement -Dsun.java2d.pmoffscreen=false  under the home directory, or simply run this command:

echo “-Dsun.java2d.pmoffscreen=false” > ~/java.opts

  • we can use SSH with compression and a faster encryption algorithm , blowfish which make the application smoother.

ssh -c arcfour,blowfish-cbc -Y -C -X REMOTE-HOST -p PORT “matlab -desktop”

SSH login without password

  1. run the following command in server-side and client-side to generate SSH key :

    ssh-keygen -t rsa

  2. import the client’s public key to the server:

    cat .ssh/id_rsa.pub | ssh REMOTE-HOST ‘ cat >> .ssh/authorized_keys’

Trouble Shooting

matlab: command not found

This error means  the PATH variable is not pointed to it. You have two options to solve such problem.

  • Create a symbolic link in /usr/local/bin and point to the executable binary of Matlab , in my case which is  “/usr/local/MATLAB/R2013a/bin/matlab”.

ln -s /usr/local/bin/matlab “/usr/local/MATLAB/R2013a/bin/matlab”

  • Run the program with absolute path.

ssh -X REMOTE-HOST “/usr/local/MATLAB/R2013a/bin/matlab -desktop”

Demo

References

C Plus / Add: Speeding up Matlab over X11 Forwarding

linux – Remotely Connect to Matlab – Stack Overflow

Linux X11 Connection Rejected Because of Wrong Authentication Error and Solution

Advertisements