Sublime Forum

How to Display Matlab Plots

#1

I hope this is the appropriate place for a question like this. Anyway, I’ve just installed SublimeText 2, and I configured it so that it can build matlab code with this code in the custom build system file:

{
    "cmd": "/Applications/MatLab.app/bin/matlab", "-nosplash", "<$file_name"],
    "selector": "source.m"
}

It should be noted that first, I had to add matlab to my math by

PATH=$PATH\:/Applications/MatLab.app/bin

And then I had to run one time

sudo matlab

So at this point, I can have my matlab code compile through Sublime Text 2, but it won’t show any generated figures/plots or things of that nature. I wash oping that someone here could point out any suggestions in this regard.

Any help is greatly appreciated :smile:

0 Likes

#2

I just had a similar problem where I wanted to insert pause commands after imshow(). I found following Matlab.sublime-build settings to be the best solution so far:

{
    "cmd": "xterm", "-e", "matlab", "-nosplash", "-nodesktop", "-r", "run $file_name; quit;"],
    "selector": "source.m"
}

This requires xterm to be installed on your linux distribution and I guess it should be quite similar on OSX. It will start xterm and run the Matlab file over there while behaving like the Matlab Desktop.

Cheers
lustiz

0 Likes

#3

I can’t seem to get this to work using Sublime Text 2, Mac OSX, and Matlab R2013a. What exactly is the xterm function that I may be missing?

0 Likes