Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating custom build system for MATLAB through Sublime Text 2
    primarykey
    data
    text
    <p>I have been editing my .m files in Sublime Text 2 (henceforth referred to as Sublime for the remainder of my question) for quite some time now, and having recently become accustomed to using the build function in Sublime for running Python code, I was trying to setup something similar for MATLAB files. I am attempting to do this because I am tired of running my code and editing my code in separate windows. </p> <p>Following the documentation, I tried using this very reasonable seeming code below, where the '-r' flag launches MATLAB to run my file, the "-nodesktop" flag launches MATLAB without the big hulking Java GUI, and the "-nosplash" flag launches MATLAB without the unnecessary splash screen. The selector allows for Sublime to automatically use this build system on m files, and the path variable sets the path to the directory that will launch MATLAB (directory found by running "which matlab"). </p> <p>I am aware that I can set an preferred text editor from within the MATLAB GUI, but I am not interested in doing that. I am interested in using Sublime as a build system in addition to a text editor.</p> <pre><code>{ "cmd": ["matlab", "-r", "-nodesktop", "-nosplash", "$file_name"], "selector": "source.m", "path": "/usr/local/MATLAB/R2012a/bin" } </code></pre> <p>Upon running build on my errorless .m file, I find this error below, which doesn't make sense. I don't think it makes sense because have launched MATLAB with the standard command line options, and am receiving MATLAB internal errors, too. </p> <pre><code>/usr/local/MATLAB/R2012a/bin/matlab: 1: /usr/local/MATLAB/R2012a/bin/matlab: awk: not found /usr/local/MATLAB/R2012a/bin/matlab: 1: /usr/local/MATLAB/R2012a/bin/matlab: expr: not found Internal error 2: Could not determine the path of the MATLAB root directory. original command path = /usr/local/MATLAB/R2012a/bin/matlab current command path = /usr/local/MATLAB/R2012a/bin/matlab Please contact: MathWorks Technical Support for further assistance. [Finished in 0.1s with exit code 1] </code></pre> <p>Has anybody else had problems like this invoking MATLAB scripts via an alternate build system? I have not tried to set up a build system for MATLAB in Sublime on any other operating system besides Ubuntu 12.04, if that information is useful.</p> <p><strong>It works now!</strong> Here is my <code>Matlab.sublime-build</code>:</p> <pre><code>{ "cmd": ["/usr/local/MATLAB/R2012a/bin/matlab", "-nosplash", "&lt;$file_name"], "selector": "source.m" } </code></pre> <p><strong>Update: I'm now hosting Sublime Text 2 R2012a build files for Linux and for Mac on my Github page as examples:</strong> <a href="https://github.com/jessebikman/Sublime-Text-2-build-Matlab-code" rel="noreferrer">https://github.com/jessebikman/Sublime-Text-2-build-Matlab-code</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload