
5 Workspace, Search Path, and File Operations
the Recycle Bin, select Properties from the context menu, and then, under
the Global tab, select the check box to Disp lay delete c on firmation dialog .
Function Alternative. To delete a file, use the
delete function. For example,
delete('d:/mymfiles/testfun.m')
deletes the file testfun.m. You can recover deleted files if you use the
recycle function or the equivalent preference des cribed in “Default B e havior
of the Delete F unction” on page 2-78.
To delete a directory and optionally its contents, use
rmdir.Forexample,
rmdir('myfiles')
removes the directory myfiles from the current directory.
Copying a nd Pasting Files and Directories
Use the Current Directory browser, to copy (or cut) and p aste files and
directories:
1 Select the files or directories to copy. Use Shift+click or Ctrl+click to select
multiple items. For a directory, the e ntire contents are copied, including
all subdirectories and files.
2 Right-click and select Copy from the context menu.
3 Navigate to the file or directory where you want to paste the items you
just copied.
4 Right-click a nd select Paste from the context menu.
Yo u can also copy and paste files and directories to and from tools outside of
MATLAB, such as Windows Explorer. You can use Current Directory browser
menu items or keyboard shortcuts, or you can drag the items.
Function Alternative. Use
movefile or copyfile to cut and paste or to copy
and paste files or directories. For example, to make a copy of the file
myfun.m
in the current directory, assigning it the nam e myfun2.m,type
copyfile('myfun.m','myfun2.m')
5-46
Commenti su questo manuale