1

I just configured my sublime text 3 for matlab a few days ago. The build is fine, and I can run a matlab file in sublime successfully.

But I had a problem when I tried to run a matlab file that calls a function in another folder. I know clearly that in matlab, in such cases, I need to add that folder to the path, and I know how to do it in matlab. But I didn't figure out how to "add folder to path" in sublime.

Does anyone have the same problem? Thanks!

(I tried to search a solution on web, but it seems that no one ask similar problems).

zhang_rick
  • 123
  • 2
  • 11
  • I'm guessing there's a matlab path variable? Or maybe just PATH. Either way, you can modify the path inside a build file. I've only done similar stuff with tex. – keyser Nov 12 '14 at 09:06
  • Thanks. Here's my build. { "cmd": ["C:\\matlab\\R2012b\\bin\\matlab","-nosplash","-nodesktop","-r","run('$file_name')"],"selector":"source.m" } By PATH, do you mean the C:\\... ? That one is the path where matlab is installed. – zhang_rick Nov 12 '14 at 09:15
  • I meant something below "cmd" that says "path": actually. Though I'd recommend that you search for sublime configs online (e.g. GitHub) and try to find some pro that has configured matlab. – keyser Nov 12 '14 at 09:19
  • Try something like this: http://stackoverflow.com/questions/22013875/access-m-files-in-a-subfolder-without-permanently-adding-it-to-the-path ? i.e. temporarily add the folder to the path for your current Matlab session using the `addpath` function – Dan Nov 12 '14 at 09:24
  • If you find you often need files from a specific folder, you can [add that path](http://www.mathworks.de/help/matlab/ref/addpath.html) in a usual MATLAB session and then [save the search path](http://www.mathworks.de/help/matlab/ref/savepath.html). That way, it is available whenever you start MATLAB (even from command line). – Lumen Nov 12 '14 at 09:25

0 Answers0