I currently take graduate school course in industrial and information system major. I use matlab quite extensively for my research and courseworks. I run it on my Macbook Pro machine.
Matlab offers a ton of features, but really, it is a resource hog clutter. Moreover I used to use vim as the primary text editor. Thus, I tried to find a workaround to get it work on command-line as an interpreter of *.m file so it can minimize resource usage (in a way).
/Applications/MATLAB_R2016a.app/bin/matlab -nosoftwareopengl -nodisplay -nodesktop -nosplash -nojvm -r "run '$1'; exit" | tail +17
Save it as "matlab" and set it as an executable file . You can either link or move it to /usr/share/bin or any directory recognized by your environment. Then, you can use it like the other commands on terminal:
$ matlab filename.m
And it worked as I expected:
I think this workaround will work also on the other operating systems, but I've never tried it before.