Sublime Forum

Problem setting up automatic build system for Matlab

#1

I’m trying to write a decent build script for Matlab in Sublime Text 2.

I’ve managed to get the build script to successfully run Matlab scripts, but, despite the documented methods for doing so, I can’t get Sublime Text 2 to create automatic builds of .m files using the “selector” syntax. What’s going on here?

Here is my build script:

[code]
{

"cmd": "/Applications/MATLAB_R2012a.app/bin/matlab", "-nosplash", "<$file_name"],

"selector": "source.m"

}[/code]

More info here in the bug section of my github page, where you can see what I and one other user has tried so far: https://github.com/jessebikman/Sublime-Text-2-build-Matlab-code/issues/1

Also, for what it’s worth, this all started as a branch off of this Stack Overflow question, which I asked: http://stackoverflow.com/questions/11869586/creating-custom-build-system-for-matlab-through-sublime-text-2

0 Likes

#2

I think you’re confusing the filename and the scopename.
selector need a scopename to work.

You can find the scopename by looking to your tmLanguage file, so here Matlab.tmLanguage.
Now at the end of the file you will find the most outer scopename that you have to use:

<key>scopeName</key> <string>source.matlab</string>
So if you replace

"selector": "source.m"

with

"selector": "source.matlab"

it must work properly.

0 Likes

#3

That solved the problem I was having. Thank you so much for the clear advice!

Now this is probably Mathwork’s problem, not Sublime’s problem, but when I run my code and all of the figures are generated, suddenly all of my figures close and I get this barrage of warnings:

>> {Warning: Objects of graph2d.lineseries class exist - not clearing this class or any of its super-classes} {Warning: Objects of graphics.datacursorbehavior class exist - not clearing this class or any of its super-classes} {Warning: Objects of graphics.panbehavior class exist - not clearing this class or any of its super-classes} {Warning: Objects of graphics.zoombehavior class exist - not clearing this class or any of its super-classes} {Warning: Objects of graphics.rotate3dbehavior class exist - not clearing this class or any of its super-classes} {Warning: Objects of graphics.ploteditbehavior class exist - not clearing this class or any of its super-classes} {Warning: Objects of scribe.legend class exist - not clearing this class or any of its super-classes} [Finished in 14.6s]

Is that familiar?

0 Likes