Desktop Tools and Development Environment Previous page   Next Page

Getting Help in the Command Window--the help Function

To quickly view a brief description and syntax for a function in the Command Window, use the help function. For example, typing

help bar

displays a description and syntax for the bar function in the Command Window. This is called the M-file help. For other arguments you can supply, see the reference page for help.

If you need more information than the help function provides, use the doc function, which displays the reference page in the Help browser. It can include color, images, links, and more extensive examples than the M-file help. For example, typing

doc bar

displays the reference page for the bar function in the Help browser.

Overloaded Functions with the help Function

When a function name is used in multiple products, it is said to be an overloaded function. The help function displays M-file help for the first function on the MATLAB search path having that name, and displays a hyperlinked list of the overloaded functions at the end.

For example, using the default search path

help set

displays M-file help for the MATLAB set function, and displays a hyperlinked list of the set functions residing in other directories, such as

database/set

which is the set function for the Database Toolbox. Click a link to display the M-file help for that set function.

To directly get help for an overloaded function, specify the name of the directory containing the function you want help for, followed by the function name. For example, to get help for the set function in the Database Toolbox, type

help database/set

Creating M-File Help for Your Own M-Files

You can create M-file help for your own M-files and access it using the help command. See the help reference page for details.

Directory Reports for Help

The Help Report and the Contents Report provide other ways of looking at and managing help for M-files--see Directory Reports in Current Directory Browser.


Previous page  View Function Reference Pages--the doc Function Other Forms of Help Next page

© 1994-2005 The MathWorks, Inc.