Development Environment |
Creating, Renaming, Copying, and Removing Directories and Files
If you have write permission, you can create, copy, remove, and rename MATLAB related files and directories for the directory shown in the Current Directory browser. If you do not have write permission, you can still copy files and directories to another directory, or you can use equivalent functions, such as movefile
.
Creating New Files
To create a new file in the current directory:
Untitled
appears at the end of the list of files shown in the Current Directory browser.
Function Alternative. Use the edit
function to create a new M-file.
Creating New Directories
To create a new directory in the current directory:
NewFolder
appears at the end of the list of files shown in the Current Directory browser.
NewFolder
with the name you want to give to the new directory.
Function Alternative. To create a directory, use the mkdir
function. For example,
creates the directory newdir
within the current directory.
Renaming Files and Directories
To rename a file or directory, select the item, right-click, and select Rename from the context menu. Type over the existing name with the new name for the file or directory, and press the Enter or Return key. The file or directory is renamed.
Function Alternative. You can use movefile
to rename a file or directory. For example,
renames myfile.m
to projectresults.m.
Cutting or Deleting Files and Directories
To cut or delete files and directories:
On Windows platforms, files you delete from the Current Directory browser go to the Recycle bin. If you do not want the selected items to go to the Recycle bin, press Shift+Delete. A confirmation dialog box displays before the items are deleted.
Function Alternative. To delete a file, use the delete
function. For example,
To delete a directory and optionally its contents, use rmdir
. For example,
removes the directory myfiles
from the current directory.
Copying and Pasting Files
Using the Current Directory browser, you can copy and paste files, but not directories. To copy and paste files:
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 name myfun2.m
, type
Viewing and Making Changes to Directories | Opening, Running, and Viewing the Content of Files |