Starting MATLAB
You can start MATLAB by double-clicking on the MATLAB icon or invoking the application
from the Start menu of Windows. The main MATLAB window, called the MATLAB Desktop,
will then pop-up and it will look like this:
The ">>" is called the command prompt, and there will be a blinking cursor right after it waiting
for you to type something. The idea is that you type commands at the command prompt for
MATLAB to execute; after you type a command at a command prompt, MATLAB executes the
command you typed in, then prints out the result. It then prints out another command prompt and
waits for you to enter another command. In this way, you can interactively enter as many
commands to MATLAB as you want.
Later lessons will go into a lot of detail about particular MATLAB commands, but for now, just to
get you started, let's enter a simple MATLAB command, the date command. Click the mouse
where the blinking cursor is and then type date and hit the enter key. MATLAB should then return
something like
where the current date should be returned to you instead of 11-Jun-1998. Congratulations! You
have just successfully executed your first MATLAB command!
>> date
ans =
27-Mar-2007
Another simple command you can try now is the clc command (clear command window). In the
MATLAB command window, if you want to clear away all the visible text and have the cursor
move to the top of the window, then type clc at the command prompt.
One final note, when you are all done with your MATLAB session you need to exit MATLAB. To
exit MATLAB, simply click the mouse on the File menu of the MATLAB command window and
then select "Exit MATLAB" (alternatively, you could just enter quit at the MATLAB command
prompt).
Getting help
Introduction
MATLAB has an extensive help system built into it, containing detailed documentation and help
information on all of the commands and functions of MATLAB. This lesson will show you how
to use the MATLAB help system.
Getting Help From The Command Line
There are three main functions that you can use to obtain help on a given function: help,
helpwin(short for help window) and doc (short for documentation). The functions help and
helpwin give you the same information, but in a different window, the doc command returns an
HTML page with a lot more information.
Below is the output of getting help on the date function, using the different functions.
>> help date
DATE Current date as date string.
S = DATE returns a string containing the date in dd-mmm-yyyy format.
See also NOW, CLOCK, DATENUM.
Note: The output of help also refers to other functions that are related. In this example the help
also tells you, See also NOW, CLOCK, DATENUM. You can now get help on these functions
using the three different commands as well.
>> helpwin date
>> doc date
Note: The output of the doc command is the most complete. It not only breaks the information
into sections, but also offers complete examples that can be studied and executed.
Using the MATLAB Help Browser
Another source of help is the MATLAB help browser. You can invoke the MATLAB help
browser by typing, helpbrowser, at the MATLAB command prompt, clicking on the help button
, or by selecting Start->MATLAB->Help from the MATLAB desktop.
The help browser has two main sections the Help Navigator, and the display pane. The display
pane, as the name implies, displays the information selected. The Help Navigator is on the left
hand side of the help browser, and should be used to navigate through the online help
information. It includes the following things:
Product filter - Set the filter to show documentation only for the products you specify.
Contents tab - View the titles and tables of contents of documentation for your products.
Index tab - Find specific index entries (selected keywords) in the MathWorks
documentation for your products.
Demos tab - View and run demonstrations for your MathWorks products.
Search tab - Look for a specific word or phrase in the documentation. To get help for a
specific function, set the Search type to Function Name.
Favorites tab - View a list of links to documents you previously designated as favorites.
Of all these functionality the two most useful are the Contents tab and the Search tab. As noted
above the Contents tab can be seen as the table of contents of the documentation. The Search tab
searches through all the documentation very efficiently and also highlights the keywords that you
are searching for in the document so that it is easier to read.