Running Matlab code from Atom


Hi! I’m trying to use atom as my default Matlab editor. I installed language-matlab and script packages. I gues the script package can be used to run matlab code. But the question in…how do I configure it? When I try to run a simple script I get the message “Unable to run matlab”.

I really like Atom, so any help will be much appreciated!


Do you have MATLAB installed on your computer?


I have this same issue, and I do have MatLab installed on my computer. I currently use atom as my editor, but then have to run test cases and debug in the matlab app. I have the script package as well as the language-matlab package, but when I try to run a script, I receive this error rmessage

Running Matlab files and scripts in Atom

What happens if you execute matlab in the Terminal?


Did anyone find a solution to this issue? I would like to know as I use Matlab heavy, and am considering using the Atom Editor.


Someone will need to answer this first before we can help further


A variety of packages, including script and process-palette work by using Atom’s API wrapper of Node’s child-process module to send messages to the system shell. As long as you can do it through a command line instruction, you can add code to Atom to do it automatically. Since I don’t know anything about Matlab, you need to explain to me how you would do what you need to do through the command line and I can tell you how to most effectively do it from Atom.


Thanks for your willingness to answer my question. Not sure that we can communicate effectively, since I lack experience with the Atom Editor and you Matlab. I was hoping someone with experience with both could/would chime in. Not looking for Atom to be my primary interface with Matlab, but if Atom can provide better text editing functionality than Matlab’s integrated editor, I would be inclined to try it out. I would also be interested if Atom could call Matlab and execute, a series of commands, or perhaps even a simple script or function. Again thanks for your desire to help.


All of that depends on whether you can send instructions to Matlab from the command line. Can you? You don’t have to know anything about how Atom operates, just how any external program would go about communicating with Matlab.


Yes, you can send a command to Matlab, for processing, from the command line.


What does a typical use case look like?


You can call Matlab from the terminal, with the -r option, ie ‘matlab -r statement’. For clarity/reference, below is the explanation per the Matlab documentation.

Execute the specified MATLAB statement, specified as a string or as the name of a MATLAB script or function. If statement is MATLAB code, enclose the string in double quotation marks. If statement is the name of a MATLAB function or script, do not specify the file extension and do not use quotation marks. Any required file must be on the MATLAB search path or in the startup folder.


If you use process-palette, you can set up a command to send the current file as a statement like so:

If you want the option, you can set up another command that sends matlab -r {selection} so that you have a quick way to run files without leaving the editor.


Again, thanks for your help. I will certainly give Atom a try. It seems like a very powerful/customizable editor! My old editor (but still good one - NEdit) has long since past its prime, and I need a new one. Here’s to hoping Atom will be a more than adequate replacement.


Atom has some performance flaws and doesn’t hold the user’s hand in any way, but for people who want to get to know an editor that will give them the freedom to do basically anything they take the time to write or find the code for, the potential is limitless.