Scripts and Functions
Topics covered in this section are
MATLAB is a powerful programming language as well as an interactive computational environment. Files that contain code in the MATLAB language are called M-files. You create M-files using a text editor, then use them as you would any other MATLAB function or command.
There are two kinds of M-files:
If you're a new MATLAB programmer, just create the M-files that you want to try out in the current directory. As you develop more of your own M-files, you will want to organize them into other directories and personal toolboxes that you can add to your MATLAB search path.
If you duplicate function names, MATLAB executes the one that occurs first in the search path.
To view the contents of an M-file, for example,