The Desktop’ manages the Command window and other MATLAB tools. The default app-earance of the Desktop is shown in Figure 1.1-1. Besides the Command window, the default Desktop includes three other windows, the Command History, Current Directory, and Workspace windows, which we discussed in the previous section. Across the top of the Desktop are a row of menu names, and a row of icons called the too/bar. To the right of the toolbar is a box showing the current directory, where MATLAB looks for files. We now describe the menus and the tool bar.
Other windows appear in a MATLAB session, depending on what you do. For example, a graphics window containing a plot appears when you use the plotting functions; an editor window, called the Editor/Debugger, appears for use in creating program files. Each window type its own menu bar, with one or more menus, at the top. Thus the menu bar wilt change as you change windows.
To activate, or select, a menu, click on it. Each menu has several items. Click on an item to select it. Keep in mind that menus are context-sensitive. Thus their contents change, depending on which features you are currently using.
The Desktop Menus
Most of your interaction will be in the Command window. When the Command window is active, the default MATLA.B 7 Desktop (shown in Figure 1.1-1) has six menus: File, Edit, Debug, Desktop, Window, and Help. Note that these menus change depending on what window is active. Every item on a menu can be selected with the menu open either by clicking on the item or by typing its underlined letter. Some items can be selected without the menu being open by using the shortcut key listed to the right of the item. Those items followed by three dots ( ••• ) open a sub-menu or another window containing a dialog box.
The three most useful menus are the File, Edit, and Help menus. The Help menu is described in Section 1.5. The File menu in MATLAB 7 contains the following items, which perform the indicated actions when you select them.
The File Menu in MATLAB 7
New Opens a dialog box that allows you to create a new program file, called an M-file, using a text editor called the Editor/Debugger, or a new Figure or Model file (a file type used by Simulink).
Open… Opens a dialog box that allows you to select a file for editing.
Close Command Window Closes the Command window.
Import Data. Starts the Import Wizard which enables you to import data easily.
Save Workspace As… Opens a dialog box that enables you save a file.
Set Path… Opens a dialog box that enables you to set the MATLAB search path.
Preferences…. Opens a dialog box that enables you to set preferences for such items as fonts, colors, tab spacing, and so forth.
Print…. Opens a ‘dialog box that enables you to print all of the Command window.
Print Selection…. Opens a dialog box that enables you to print selected portions of the Command window.
File List Contains a list of previously used files, in order of most recently used.
Exit MATLAB Closes MATLAB
The Edit menu contains the following items.
The Edit Menu in MATLAB 7
Undo Reverses the previous editing operation.
Redo Reverses the previous Undo operation.
Cut Removes the selected text and stores it for pasting later.
Copy Copies the selected text for pasting later, without removing it.
Paste Inserts any text on the clipboard at the current location of the cursor.
Paste Special… Inserts the contents of the clipboard into the workspace as one or more variables.
Select All Highlights all text in the Command window.
Delete Clears the variable highlighted in the Workspace Browser.
Find… Finds and replaces phrases.
Find Files…. Finds files.
Clear Command Window Removes all text from the Command window.
Clear Command History Removes all text from the Command History window.
Clear Workspace Removes the values of all variables from the workspace.
You ca!l use the Copy and Paste selections to copy and paste commands appearing on the Command window. However, an easier way is to use the up-arrow key to scroll through the previous commands, and press Enter when you see the command you want to retrieve.
Use the Debug menu to access the Debugger, which is discussed. Use the Desktop menu to control the configuration of the Desktop and to display toolbars. The Window menu has one or more items, depending on what you have done thus far in your session. Click on the name of a window that appears on the menu to open it. For example, if you have created a plot and not closed its window, the plot window will appear on this menu as Figure 1. However, there are other ways to move between windows (such as pressing the Alt and Tab keys simultaneously).
The toolbar, which is below the menu bar, provides buttons as shortcuts to some of the features on the menus. Clicking on the button is equivalent to clicking on the menu, then clicking on the menu item; thus the button eliminates one click of the mouse. The first seven buttons from the left correspond to the New M-File, Open File, Cut, Copy, Paste, Undo, and Redo. The eighth button activates Simulink. The ninth button activates the GUIDE Quick start, which is used to create and edit graphical user interfaces (GUIs). The tenth button (the one with the question mark) accesses the Help System.