- NOT built-in functions. User-defined functions.
- An efficient way to construct programs is to use user-defined functions, saved as m-files.
- These programs allow the user to specify the input and output parameters.
- They are easily called as subroutines in other programs.
- Construct an m-file in the m-file Editor/Debugger (by selecting New under File menu).
- Example: Place the function
in the m-file fun.m.
- In the Editor/Debugger:
*************Write into m-file****************
*********************************************
- Once this function is saved as an m-file named fun.m, try the following commands;
- Functions can be defined recursively!
- Follow the above procedure for the function below and save under the name of fact.m,
>>fact(333)
Cem Ozdogan
2010-09-29