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.

Creating New Files

To create a new file in the current directory:

  1. Select New from the context menu or File menu and then select the type of file to create.

    An icon for that file type, for example an M-file icon , with the default name Untitled appears at the end of the list of files shown in the Current Directory browser.

  1. Type over Untitled with the name you want to give to the new file.
  2. Press the Enter or Return key.

    The file is added.

  1. To enter the contents of the new M-file, open the file - see Opening, Running, and Viewing the Content of Files.

Create New Directories

To create a new directory in the current directory:

  1. Click the new folder button in the Current Directory browser toolbar, or select New -> Folder from context menu.

    An icon, with the default name NewFolder appears at the end of the list of files shown in the Current Directory browser.

  1. Type over NewFolder with the name you want to give to the new directory.
  2. Press the Enter or Return key.

The directory is added.

Function Equivalent.   To create a directory, use the mkdir function. For example,

creates the directory newdir within the directory testdata.

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.

Cutting or Deleting Files and Directories

To cut or delete files and directories:

  1. Select the files and directories to remove. Use Shift-click or Ctrl-click to select multiple items.
  2. Right-click and select Cut or Delete from the context menu. Cut is also available from the Edit menu.

    Note that to delete a directory, you must first delete its contents.

The files and directories are removed.

Function Equivalent.   To delete a file, use the delete function. For example,

deletes the file testfun.m.

Copying and Pasting Files

You can copy and paste files, but not directories. To copy and paste files:

  1. Select the files. Use Shift-click or Ctrl-click to select multiple items.
  2. Right-click and select Copy from the context menu, or select Copy from the Edit menu.
  3. Move to the directory where you want to paste the files you just copied or cut.
  4. Paste the files by right-clicking and selecting Paste from the context menu, or by selecting Paste from the Edit menu.

 Changing the Display Opening, Running, and Viewing the Content of Files