Skip to content

Instantly share code, notes, and snippets.

@nrubin
Last active August 17, 2017 14:21
Show Gist options
  • Save nrubin/5088096 to your computer and use it in GitHub Desktop.
Save nrubin/5088096 to your computer and use it in GitHub Desktop.
Build System for Sublime Text 2 for MATLAB files on Windows
{
"cmd": ["C:\\Program Files\\MATLAB\\R2012b\\bin\\matlab", "-nosplash", "-nodesktop", "-r", "run('$file_name')"],
"selector": "source.m"
}
@nrubin
Copy link
Author

nrubin commented Mar 5, 2013

In Sublime Text 2 in Windows, navigate to Tools > Build System > New Build System, copy the above code into that file, and save the file as "matlab.sublime-build" in the directory Sublime recommends saving it to. Now, when you build a .m file in ST2, a lite version of MATLAB will open up and run your code. woo!

@nrubin
Copy link
Author

nrubin commented Mar 5, 2013

Also, to get Sublime Text 2 to nicely recognize .m files as MATLAB files, go to View > Syntax > Open all with current extension as.... and select MATLAB.

@TheoT
Copy link

TheoT commented Mar 7, 2013

thanks nrubin!

@japborst
Copy link

This works great, thanks!

Note to future users: remember to change the path to your build, mine was R2013a

@diego898
Copy link

when using this a matlab command window appears and runs the script. The problem Im having is that multiple runs of a script cause multiple command windows to open. These are multiple full fledged instances of matlab! I cant figure out how to make it use instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment