Next: Defining Functions, Up: Functions and Scripts [Contents][Index]
11.1 Introduction to Function and Script Files ¶
There are seven different things covered in this section.
- Typing in a function at the command prompt.
- Storing a group of commands in a file — called a script file.
- Storing a function in a file—called a function file.
- Subfunctions in function files.
- Multiple functions in one script file.
- Private functions.
- Nested functions.
Both function files and script files end with an extension of .m, for
MATLAB compatibility. If you want more than one independent
functions in a file, it must be a script file (see Script Files),
and to use these functions you must execute the script file before you
can use the functions that are in the script file.