|MATLAB Environment||Search  Help Desk|
Command Line EditingThese are the main aspects of command line editing in MATLAB:
Basics of Command Line EditingThese are the basic features of command line editing in MATLAB:
>>) indicates MATLAB is ready to accept commands from you. Arrow and Control Keys. Use these keys to help you edit in the command line.
||Recall previous line.
||Recall next line.
||Move back one character.
||Move forward one character.
||Move right one word.
||Move left one word.
||Move to beginning of line.
||Move to end of line.
||Delete character at cursor.
||Delete character before cursor.
||Delete (kill) to end of line.
clcto clear the Command Window. This does not clear the workspace, but only clears the view. After using
clc, you still can use the up arrow key to see the history of the commands, one at a time. Paging of Output. Use
moreto control paging of output in the Command Window. By default,
off. When you set
on, a page (screenful) of output displays at one time. You then use:
||To advance to the next line
||To advance to the next page
||To stop displaying the output
...), followed by Return or Enter to indicate that the statement continues on the next line. For example,
Interrupting a Running Program. Press Ctrl-c at any time to interrupt a running program. On Windows platforms, you may have to wait until an executing built-in function or MEX-file has finished its operation. On UNIX systems, program execution terminates immediately. Controlling Numeric Format. The
s = 1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 + 1/7 ...
- 1/8 + 1/9 - 1/10 + 1/11 - 1/12;
formatcommand controls the numeric format of the values displayed on the screen. The command affects only how numbers are displayed, not how MATLAB computes or saves them. For more control over the output format, use
fprintf. On Windows platforms, you can change the default format by selecting Preferences from the File menu, and selecting the desired format from the General tab.
MATLAB WorkspaceThe MATLAB workspace contains a set of variables (named arrays) that you can manipulate from the MATLAB command line. These are the topics for using the MATLAB workspace:
whoscommands to see what is currently in the workspace.
clearto delete all existing variables from the workspace. Loading and Saving the Workspace. MATLAB's
loadcommands let you save the contents of the MATLAB workspace at any time during a session and then reload the data back into MATLAB during that session or a later one.
savecan also import and export text data files. On Windows platforms, the
saveoperation is also available by selecting Save Workspace As from the File menu. The
loadoperation is also available by selecting Load Workspace from the File menu.
Search PathThese topics are for working with files and directory structures:
fooat the MATLAB prompt, the MATLAB interpreter:
fooas a variable.
fooas a built-in function.
path, by itself, returns the current search path.
sis a string, sets the path to
path(path,'/home/lib')both append a new
rmpath /home/libremoves the path
pathdef.min the directory named
localon your system.
pathdefexecutes automatically each time you start MATLAB. On Windows platforms, you can directly edit
pathdef.mwith your text editor. On UNIX workstations you may not have file system permission to edit
pathdef.m. In this case, put
addpathcommands in your
startup.mfile to change your path defaults. MATLAB also provides a Path Browser with a convenient interface for viewing and changing the search path. Use
pathtoolto start the Path Browser. Files on the Search Path. Use these commands to see and use files on the search path.
pathto display the search path.
whatto see all of the MATLAB files in a directory. With no arguments,
whatdisplays the files in the current directory.
typeto see the code in a specific M-file.
editto edit an M-file.
cdwith no arguments to display the current directory.
cdwith a path to change the current directory.
opento open files in MATLAB based on their extension as shown in the table below.
|Figure file (
||Open figure in a figure window
||Open the corresponding M-file,
|Other extensions (