Run a Matlab script from the shell or from another program

Yeah, I know Matlab is not open source, but this is useful to know anyway:

You can run Matlab in batch mode and pass a script to it from the system shell. If the m-file xyz.m is in the current directory, then run it from the system shell with:

matlab -nodesktop -nosplash -nojvm -r "xyz"

Note that there is no .m extension on xyz in this command . . . if you do put the extension you will get an error, “??? Undefined variable “xyz”" or class “xyz.m”.

0 Responses to “Run a Matlab script from the shell or from another program”


  • No Comments

Leave a Reply