Running Matlab Remotely: ssh -X
After bit of a search I found the solution. You have to set the X11 forwarding in you ssh configuration file. Here's how to do it.
1. cd /etc/ssh
2. sudo vi ssh_config
3. uncomment the lines "ForwardAgent" and "ForwardX11". Set their values to "yes"
4. sudo vi sshd_config
5. uncomment "X11Forwarding" and set it value to "yes" as well.
that's it and you are good to go.
Type ssh -X username@domain
To test if everything works fine try running xclock once you log in. It should open up a graphical clock window.