Download (direct link):
Figure 2-2: Desktop with the Workspace Browser.
calculation by accident. Finally, we observe that the Workspace browser presents a graphical alternative to whos. You can activate it by clicking on the Workspace tab, by typing workspace at the command prompt, or through the View item on the menu bar. Figure 2-2 depicts a Desktop in which the Command Window and the Workspace browser contain the same information as displayed above.
Errors in Input
If you make an error in an input line, MATLAB will beep and print an error message. For example, here's what happens when you try to evaluate 3u"2:
Error: Missing operator, comma, or semicolon.
The error is a missing multiplication operator *. The correct input would be 3*u"2. Note that MATLAB places a marker (a vertical line segment) at the place where it thinks the error might be; however, the actual error may have occurred earlier or later in the expression.Online Help 15
O Missing multiplication operators and parentheses are among the most common errors.
You can edit an input line by using the up-arrow key to redisplay the previous command, editing the command using the left- and right-arrow keys, and then pressing return or enter. The up- and down-arrow keys allow you to scroll back and forth through all the commands you've typed in a MATLAB session, and are very useful when you want to correct, modify, or reenter a previous command.
There are several ways to get online help in MATLAB. To get help on a particular command, enter help followed by the name of the command. For example, help solve will display documentation for solve. Unless you have a large monitor, the output of help solve will not fit in your MATLAB command window, and the beginning of the documentation will scroll quickly past the top of the screen. You can force MATLAB to display information one screenful at a time by typing more on. You press the space bar to display the next screenful, or enter to display the next line; type help more for details. Typing more on affects all subsequent commands, until you type more off.
The command lookfor searches the first line of every MATLAB help file for a specified string (use lookfor -all to search all lines). For example, if you wanted to see a list of all MATLAB commands that contain the word "factor" as part of the command name or brief description, then you would type lookfor factor. If the command you are looking for appears in the list, then you can use help on that command to learn more about it.
The most robust online help in MATLAB 6 is provided through the vastly improved Help Browser. The Help Browser can be invoked in several ways: by typing helpdesk at the command prompt, under the View item in the menu bar, or through the question mark button on the tool bar. Upon its launch you will see a window with two panes: the first, called the Help Navigator, used to find documentation; and the second, called the display pane, for viewing documentation. The display pane works much like a normal web browser. It has an address window, buttons for moving forward and backward (among the windows you have visited), live links for moving around in the documentation, the capability of storing favorite sites, and other such tools.
You use the Help Navigator to locate the documentation that you will explore in the display pane. The Help Navigator has four tabs that allow you to16 Chapter 2: MATLAB Basics
arrange your search for documentation in different ways. The first is the Contents tab that displays a tree view of all the documentation topics available. The extent of that tree will be determined by how much you (or your system administrator) included in the original MATLAB installation (how many toolboxes, etc.). The second tab is an Index that displays all the documentation available in index format. It responds to your key entry of likely items you want to investigate in the usual alphabetic reaction mode. The third tab provides the Search mechanism. You type in what you seek, either a function or some other descriptive term, and the search engine locates corresponding documentation that pertains to your entry. Finally, the fourth tab is a roster of your Favorites. Clicking on an item that appears in any of these tabs brings up the corresponding documentation in the display pane.
The Help Browser has an excellent tutorial describing its own operation. To view it, open the Browser; if the display pane is not displaying the "Begin Here" page, then click on it in the Contents tab; scroll down to the "Using the Help Browser" link and click on it. The Help Browser is a powerful and easy-to-use aid in finding the information you need on various components of MATLAB. Like any such tool, the more you use it, the more adept you become at its use.
? If you type helpwin to launch the Help Browser, the display pane will contain the same roster that you see as the result of typing help at the command prompt, but the entries will be links.