I'm learning matlab and using emacs to edit .m files.
Is there a method in Emacs to call
matlab to run programs?
You can make MATLAB slurp in a
.m file by feeding it to its standard input. In Emacs-speak, it is:
M-! matlab < foo.m
You might consider switching to Octave for this instead, however. Since GNU Octave is free like Emacs, you're going to find a lot more info out there about using the two together than for the non-free Matlab. Since Octave speaks much the same language as Matlab, it might be a complete replacement for your purposes.
One of the nice things you get by using Octave instead is that recent Emacsen know how to run Octave as an inferior process. This lets you have a window where you can type interactive commands and get feedback. This is very helpful while developing a more complex
Unlike MATLAB, Octave also knows how to behave like a proper Unixy scripting language. This lets you shorten the Emacs command above to: