3. Scripts and Functions
Tobin A. Driscoll · Society for Industrial and Applied Mathematics eBooks · 2009
An M-file is a plain text file containing MATLAB commands and saved with the filename extension .m. There are two types, scripts and functions. MATLAB comes with a good editor that is tightly integrated into the environment; start it by typing edit. However, you are free to use any text editor. An M-file should be saved in the path in order to be executed. Recall that the path is a list of directories (folders) in which MATLAB will look for files. Use editpath or menus to see and change the path.