Search code examples
matlabsshmatlab-figureforwardingx11-forwarding

X11 MATLAB Display Figure


I know it's possible to forward any output from a remote machine to a local one by using the X11 forwarding remote tunnelling, so that when you run a MATLAB command it will display all the graphical outputs back to the machine you've connected from.

My question is:

Is there any MATLAB command to just output the figures (e.g., plot,surf,etc.) without displaying any other graphical object (i.e., the main interface)?

In practice, I would like to interact with MATLAB by using the command line (as shown below) and forward back only the figures.

enter image description here


Solution

  • MATLAB cannot display figures without its own figure-GUI, so the answer to your question would be no.

    However: there is a workaround: create an invisible figure using f=figure('visible', 'off'), then plot your data, and finally use saveas(f,filename,fileextention). Don't forget to close(f) your figure after saving, to free the RAM. You'll now have a figure in your file directory, which you can display using your favourite visualising tool, which might even be possible through a call to system, although I have never tested that.