Lecture 27
Recap
Function M-files
Syntax of Function M-Files
Comments
Multiple Input and Output Functions
Functions with No Input or No
Output
Although most functions need at least one input and
return at least one output value, in some situations no
inputs or outputs are required
For example: consider this function, which draws a star
in polar coordinates:
function [] = star( )
theta = pi/2:0.8*pi:4.8*pi;
r = ones(1,6);
polar(theta,r)
The square brackets on the first line indicate that the
Continued….
There are numerous built-in MATLAB functions that do
not require any input.
For example:
A = clock
returns the current time:
A =
1.0e+003 *
Columns 1 through 4
2.0050 0.0030 0.0200 0.0150
Columns 5 through 6