MATLAB Function Reference | ![]() ![]() |
Display help for MATLAB functions in the Command Window
Syntax
help help / help function help toolbox/ helptoolbox
/function
Description
help
lists all primary help topics in the Command Window. Each main help topic corresponds to a directory name on MATLAB's search path.
help /
lists all of the operators and special characters, along with their descriptions.
help function
displays M-file help, a brief description and the syntax, for function
in the Command Window. If function
is overloaded, help
displays the M-file help for the first function
found on the search path, and lists the overloaded functions.
help toolbox/
displays the contents file for the specified directory, toolbox
. It is not necessary to give the full pathname of the directory; the last component, or the last several components, is sufficient.
help
displays the M-file help for toolbox
/function
function
that belongs to the specified toolbox
.
Creating Online Help for Your Own M-Files
MATLAB's help system, like MATLAB itself, is highly extensible. You can write help descriptions for your own M-files and toolboxes using the same self-documenting method that MATLAB's M-files and toolboxes use.
The help
function 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.
Typing 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.
Typing help
topic
, where topic
is a function name, displays help for the function by listing the first contiguous comment lines in the M-file topic.m
.
Create self-documenting online help for your own M-files by entering text on one or more contiguous comment lines, beginning with the second line of the file (first line if it is a script). For example, an abridged version of the M-file angle.m
provided with MATLAB could contain
function 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));
When you execute 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 should contain the function name and a brief description of the function. The lookfor
function searches and displays this line, and help
displays these lines in directories that do not contain a Contents.m
file.
Creating Contents Files for Your Own M-File Directories
A 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 should create Contents.m
files for them too. To do so, simply follow the format used in an existing Contents.m
file.
Examples
help datafun
displays help for the datafun
directory.
help fft
displays help for the fft
function.
To prevent long descriptions from scrolling off the screen before you have time to read them, enter more on
, and then enter the help
function.
See Also
doc
, helpbrowser
, helpwin
, lookfor
, more
, partialpath
, path
, what
, which
![]() | hdf | helpbrowser | ![]() |