MATLAB
has an extensive help system built into it, containing detailed documentation
and help information on all of MATLAB's many commands and functions. This
help system is extremely useful for beginners to MATLAB, but even after
becoming an expert at MATLAB, you will still use the help system often to
refresh your memory of the details of particular MATLAB commands and
functions. This lesson will show you how to use the MATLAB help system.
There are
two equivalent ways (i.e., both ways access the same underlying information)
that you can access the MATLAB help system. The first is simply to type at
the command prompt in the MATLAB command window "help" followed by
the name of the command or function for which you want help. Doing this will
then present you with some text describing the MATLAB command or function you typed. Here is how you access the help
information for the date command. » help
date Notice
how it also tells you "See also NOW, CLOCK, DATENUM"
after giving you the help information for "date". These are related
MATLAB commands or functions, and you can access their help information in the
same way (i.e., "help now", etc.) In general, when returning help
information about some command or function, MATLAB will also suggest similar
commands or functions in this way. Go ahead now and try using the help
command; type "help date", "help now", and even
"help help" (there is even help information for the help command
itself!) at the command prompt.
You
probably noticed that when you typed "help help" at the command
prompt, the help information that was returned to you was too long to fit on
one screen, and thus what you ended up with in the MATLAB command window's
screen was only about the last half of the help information for
"help". You could just go to the beginning of the help text by
using the scroll bar at the right side of the window, and scrolling up to the
beginning of the returned help text. However, it would be nice if there were
some way you could have MATLAB return the information to you one screen at a
time; then, after reading one screenful of the help text you could just hit a
key on the keyboard and move on to the next screenful. Happily, there is in
fact a way to do this with the "more" command. The way it works is
as follows. If you type "more on" at the command prompt, then all
help information returned after that will be presented in readable,
screen-at-a-time chunks (with the text "--more--" at the bottom);
pressing the space bar will then move you to the next screenful of help text
(i.e., it will give you "more" text), while pressing any other key
will move you on to just the next line of help text. Typing "more
off" at the command prompt will revert to the default behavior (i.e.,
all help text will be presented at once, and you will have to scroll back to
the beginning for some long help texts.) Go ahead now and try using the
"more" command; type "more on" and then "help
help" and then the space bar or other keys to progress through the help
text.
An
important thing to note is that MATLAB groups all commands and functions into
various functional categories. For example, there is one functional category
called "timefun" and the "date" and "now"
commands are members of this functional category. If you just type
"help" by itself at the command prompt, you will get a list of all
of MATLAB's functional categories (called "HELP topics" below): » help In
addition, you can get help information about a particular functional
category, and its member commands and functions, by simply typing at the
command prompt "help" followed by the name of the functional category.
For example, typing "help timefun" will give you information about
the "timefun" functional category: » help
timefun
Another
important command for accessing the MATLAB help system is the
"lookfor" command. Recall that "help" will display the
help text for some command or function, but you have to know the exact name
of the command or function in order to be able to get this help text. What if
you don't have any particular command or function in mind, or don't know the
exact name, but rather would like to get a list of all commands or functions
related to some word? This is precisely what the "lookfor" command
can do for you. At the command prompt, you type "lookfor" and then
a keyword, and MATLAB will search the help texts of
all commands and functions. Any command or function whose first line of help
text contains the given keyword will be returned by the "lookfor"
command. You should be warned, however, that the "lookfor" command
can take a long time to complete. As an example, typing "lookfor
sine" returns the following: » lookfor
sine
The
second way to access the MATLAB help information is more graphical and
windows-oriented. It allows you to open up a separate window (the MATLAB help
window) in which you can view and navigate through the help information by
typing command names, clicking buttons, selecting text, etc. You can open up
this help window by either typing "helpwin" at the command prompt,
or by selecting "Help Window" from the "Help" menu at the
top right side of the MATLAB command window. The MATLAB help window will look
like this, and will initially contain the list of all the functional
categories: You can
then see the help information for a particular functional category by double
clicking the mouse on the text of the functional category in the help window.
For example, double clicking the line containing the text
"matlab\elfun" above would give you the help information for the
"elfun" functional category. Then, you can double click particular
commands and functions in the chosen functional category to get help
information for them. You can navigate to previous screens by clicking the
"Back" button, and then back to where you were by clicking the
"Forward" button; clicking the "Home" button takes you to
the initial screen (with the list of all functional categories). If you type
a functional category, or a command or function name, into the text box at
the upper left (i.e., the one that says "MATLAB Help Topics" above)
and then hit return, you will get the help information for it. Finally, the
place where it says "see also" above is a menu from which you can
select related commands and functions, and get help information for them. At
the command prompt in the MATLAB command window, you can also just type
"helpwin" followed by a functional category or command or function
name to have the MATLAB help window open up with the help information for
that functional category or command or function. To
continue on to the next lesson, click here. |