MAE 08 Lecture 17: Chapter 6
Document Summary
User defined functions: multiple inputs multiple outputs. Inputs no outputs: no inputs outputs, no inputs no outputs, passing arguments between scripts/functions. Matlab program organization: primary functions/ subfunctions, variable scope: local, persistent, global, modular programs. Multiple functions can be put in the same file. The first function is the primary function. Other functions are subfunctions which are called by the primary function. Name of the primary function must match with the name of the m-file. Subfunctions are only known to primary function. Subfunctions can not be called form the command window. Scope of any variable is the workspace in which it is valid. The workspace created in the command window is called the base workspace. When a variable is created in a function, it is a local variable to that function (function workspace) Local variables only exist while the functions is executing, they cease to exist when the function stops executing.