Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

how to use matlab remotly

Asked by sara on 21 Jul 2011

Hi all

I will be accessing my work computer from home and i need to make some graphs , ( dont have matlab in my home computer) but i do in my work computer. also i am using linux

i was wondering does anybody know how to do that 1: run matlab in the work computer while accessing form home 2 if i have a script . can i use it and how do i run it.

Any help will be appreciated thank you

Sara

0 Comments

sara

Products

No products are associated with this question.

5 Answers

Answer by Walter Roberson on 21 Jul 2011
Accepted answer

One of the common remote graphics protocols that is usable on Linux and Windows is named VNC.

Unfortunately I have not been able to get VNC to work properly with MATLAB (or some other programs.) The difficulty I encounter is that any JAVA component does not render in to the VNC-relayed area. No graphs, no desktop.

What kind of system are you using at home? It may have X (Linux has it; Mac OS has it but you might have to start it up first; you can get commercial X for MS Windows from Hummingbird; you can get free X for MS Windows in a unix emulation layer such as AT&T's uwin). If you have X and can get it set up properly, then ssh -X (Unix-style) or putty (Windows) should be able to allow you to do a remote login to the system at work (firewalls permitting) and to display the graphics to your desktop. Depending on your line speed and the latency to your workplace, the result might be somewhere between "sluggish but okay" and "I could have walked to work, done everything, and walked back before it rendered the first screen!".

I work less than 5 km from my office, but my office's internet connection goes through a private network to a central control point more than 1500 km away; the resulting latency makes it take about 4 minutes per frame to render. My blood pressure can't deal with that.

VNC works much much faster than remote X except perhaps in high-speed local networks; unfortunate that VNC will not work with Java for me.

3 Comments

sara on 21 Jul 2011

I am able to access my work computer form hoem using ssh and i did try opening matlab but it said that i can see the dislay. so how do i use matlab if i cannot see it , is there any code or command that i can use to run script and get plots

Thank you

Walter Roberson on 21 Jul 2011

Make sure you use ssh -X

Without the -X it will not attempt to tunnel the X protocol and will not set up proper X authentication.

Doug on 1 May 2013

Quick note about speed: many operating systems support the "ssh -XC" option, which enables compression on the connection and speeds X up dramatically. (VNC uses compression by default.)

Walter Roberson
Answer by the cyclist on 21 Jul 2011

I assume your work machine is on a network. Are you able to use a virtual private network (VPN) to connect your home machine to that network? That is probably the most common practice these days.

There is also something called "remote desktop protocol" that you can use. I've only done it from a PC, but I think you can do it from Unix as well.

Also, although I have not done it, you can run MATLAB remotely via smart phone app now.

1 Comment

Sean de Wolski on 22 Jul 2011

I can do that with Macintosh and I do. The ML window tends to be a little fuzzy but I think that's just the graphics card.

the cyclist
Answer by sara on 21 Jul 2011

I am able to access my work computer form hoem using ssh and i did try opening matlab but it said that i can see the dislay. so how do i use matlab if i cannot see it , is there any code or command that i can use to run script and get plots

Thank you

1 Comment

Jason Ross on 22 Jul 2011

I assume you mean "can not see the display"? If you want to see plots, you need to use VNC Server on the Linux host and connect to that VNC session from your home PC.

sara
Answer by Jason Ross on 22 Jul 2011

How I remotely connect to a Linux machine from a Windows machine over VPN. I am assuming your home machine is Windows -- but these steps are the same for any arbitrary VNC client, be it on Windows, Linux or Mac.

  1. Make a VPN connection.
  2. Open a terminal to the Linux host from your Windows machine. This is likely done with PuTTY/ssh.
  3. Type "startvnc". This will start the VNC server. In the output, you will see the desktop name that has been started -- something like "my-linux-host:2"
  4. Using a VNC client on the Windows machine, connect to the VNC desktop session you started.
  5. Start MATLAB in this session. Ideally this will load with the same desktop environment that you are used to.

I like using VNC versus forwarding X, as the VNC method keeps your session running even when you lose network connectivity, which can and does happen for any number of reasons. It's also faster and more responsive, for the most part, for the reasons Walter already mentioned. I've also found that it can help immensely to play around with the VNC settings and try a couple of different VNC clients -- some behave better than others connecting to some systems.

A word of caution, though -- VNC is not the most secure protocol in the world. If you work for a company/institution that is extremely sensitive about network security, it would behoove you to ask for the "proper" way to do this, as there are ways to make things more secure, but they require more setup.

1 Comment

sara on 22 Jul 2011

Thank you

Sara

Jason Ross
Answer by Bjorn Gustavsson on 22 Jul 2011

Also if you run long sessions from Linux/UNIX/(Mac?) over network you have to guard yourself from time-outs that close the connection. Do this by running matlab from inside 'screen'. Then you can dettach and reattach the matlab session without losing it.

2 Comments

sara on 22 Jul 2011

how can i dettach and reattach the matlab session without losing it??

Thank you

Bjorn Gustavsson on 22 Jul 2011

From an terminal start screen, then start matlab (I guess you migh have to run it without the desktop so: matlab -nodesktop). Then you should be able to run everything just as usual. When you "need" to detach it is just to hit Control-a Control-d. Then to reattach I usually have to check for what screen session to reattach by typing: screen -ls to list the current "screens"; then to reattach it is just to type: screen -d -r ; possibly with the pid.tty number: screem -d -r pid.tty.host.

Should work.

Bjorn Gustavsson

Contact us