Chapter 5 Script Files
Up to this point we have been using MATLAB as a calculator: entering commands one-at-a-time. While useful for some situations, commands entered in the Command Window cannot be saved and executed again (well, other than through the command history window, of course, but that’s not really a great way to re-issue lists of commands).
An alternate way of entering commands in MATLAB is to create a file containing a list of commands, save it, and run that file within MATLAB. Such a file is known as a script file or M-file (because the file extension is .m)