“
f
f
u
u
n
n
c
c
t
t
i
i
o
o
n
n [] =
p
p
r
r
i
i
n
n
t
t
_
_
r
r
e
e
s
s
u
u
l
l
t
t
s
s (x)”
The variables that you pass to the function do not need to have the same
name as those in the function definition line.
5.1.1.2 The H1 Line
The H1 line, so named because it is the first help text line, is a comment line
immediately following the
f
f
u
u
n
n
c
c
t
t
i
i
o
o
n
n definition line. Because it consists of
comment text, the H1 line begins with a percent sign, "%." For the
D
D
i
i
a
a
g
g
E
E
x
x
t
t
r
r
a
a
c
c
t
t, the H1 line is:
“% DiagExtract returns the diagonal elements of a square matrix (not single values).”
This is the first line of text that appears when a user types
h
h
e
e
l
l
p
p
function_name at the Matlab prompt. Further, the
l
l
o
o
o
o
k
k
f
f
o
o
r
r searches and
displays only the H1 line of the functions. Because this line provides
important summary information about the m-file, it is important to make it
as descriptive as possible.
5.1.1.3 The Help Text
You can create online help for your m-files by entering text on one or more
comment lines beginning with the line immediately following the H1 line. The
help text for the
D
D
i
i
a
a
g
g
E
E
x
x
t
t
r
r
a
a
c
c
t
t function is:
“% This function takes as input a square matrix named X and does the followings:
% 1. If by mistake the user does not enter a square matrix, it returns
% an error message
% 2. If a square matrix is correclty entered, then it returns the
% elements of its main diagonal in vector V ”
When you type
h
h
e
e
l
l
p
p function_name, Matlab displays the comment lines that
appear between the function definition line and the first non-comment
(executable or blank) line. The help system ignores any comment lines that
appear after this help block.
Komentarze do niniejszej Instrukcji