I’ve just started experimenting something with Matlab, and since I’m used to Vim’s interface, I try to stay out of Matlab’s editor as much as possible. What’s troubling me is that every time I start a .m file, it brings up the interface.
Is there a way to start test.m from a cmd line, and let it give output out on a cmd, as it would normally do in Matlab’s environment. Something like a ‘Matlab shell’ (like Python’s, only Matlab’s)?
To answer your question, start matlab like this:
matalb -nodesktop -nosplashThis does work on both linux and windows. On linux, you type this at the command prompt, and matlab will run in that same command window in text mode. So you would get the ‘matlab shell’ you wanted. On windows, cd into the directory where matlab is installed, and type the same command. It will open a stripped-down matlab command line window, without all the bells and whistles of the matlab desktop.
Now in my personal opinion, the matlab editor with its integrated debugger is your friend. It also has emacs key bindings, if that helps. It is also easier to execute commands and look at the results in matlab desktop then when matlab is run in text mode. The only time you really want to use the text mode is if your matlab code takes a long time to run, and you are only interested in the final result. Or if you are running multiple instances of matlab. The text mode takes much less memory, and on linux you can easily start a run from the command line and put it into background.
In fact, check the command line arguments for matlab. You can do other interesting things, like have matlab execute a single function and exit, a la perl, or redirect a script into matlab like this:
matlab < script.m