At the end of this chapter you should be able to
- Identify the key differences between scripts and functions.
- Edit and run an m-file (both functions and scripts).
- Create a function with one, two or more input parameters and
one, two or more output parameters.
- Use comment statements to add documentation to scripts and functions.
- Use disp to print a string and a matrix to the command window.
- Use relational operators (<, <=, >, >=,
~=
),
and logical operators (&
, |, ~
).
- Use if...end, if...elseif...end,
and if...elseif...else...end constructs.
- Use for loops
- Use while loops
- Know the difference between break and return, and know
how and where to use each.
- Use feval. Know how to pass a function name as an input parameter
to another function.