help
help topic
help
, by itself, lists all primary help topics. Each main help topic corresponds to a directory name on MATLAB's search path.
help
topic
gives help on the specified topic. The topic can be a function name or a directory name. If it is a function name, help
displays information on that function. If it is a directory name, help
displays the contents file for the specified directory. It is not necessary to give the full pathname of the directory; the last component, or the last several components, is sufficient.
You can write help text for your own M-files and toolboxes; see the following sections for more information.
help
, by itself, lists all help topics by displaying the first line (the H1 line) of the contents files in each directory on MATLAB's
search path. The contents files are the M-files named Contents.m
within each directory.
help
topic
, where topic
is a directory name, displays the comment lines in the Contents.m
file located in that directory. If a contents file does not exist, help
displays the H1 lines of all the files in the directory.
help
topic
, where topic
is a function name, displays help on the function by listing the first comment lines in the M-file topic.m
.
angle.m
provided with MATLAB contains:
When you executefunction p = angle(h)
% ANGLE Polar angle.
% ANGLE(H) returns the phase angles, in radians, of a matrix
% with complex elements. Use ABS for the magnitudes.
p = atan2(imag(h),real(h));
help angle
, lines 2, 3, and 4 display. These lines are the first block of contiguous comment lines. The help system ignores comment lines that appear later in an M-file, after any executable statements, or after a blank line.
The first comment line in any M-file (the H1 line) is special. It contains the function name and a succinct description of the function. The lookfor
command searches and displays this line, and help
displays these lines in directories that do not contain a Contents.m
file.
Contents.m
file is provided for each M-file directory included with the MATLAB software. If you create directories in which to store your own M-files, you can create Contents.m
files for them too. To do so, simply follow the format used in an existing Contents.m
file.
demos
directory:
help demos
To prevent long descriptions from scrolling off the screen before you have time to read them, enter more
on
; then enter the help
command.
dir
,lookfor
,more
,path
,what
,which
(c) Copyright 1994 by The MathWorks, Inc.