| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
Right-click at the location for the new folder. See Locations for Storing Your Files.
From the context menu, select New Folder.
Type the name for the new folder.
Press Enter.
Right-click at the location for the new file. See Locations for Storing Your Files.
From the context menu, select New File.
Select the type of file you want to create: Blank, Function, Class, or Model.
The function or class M-file contains template information that prompts you to provide fundamental elements for the file.
Type the name for the new file.
For naming conventions, see Function Name and Naming M-files.
Press Enter.
To create or update a MAT-file using variables in the workspace:
In the Current Folder browser, change the current folder to the folder where you want to save the variables. See Locations for Storing Your Files.
In the Workspace browser, select the variables to save.
Drag the selected variables from the Workspace browser to the Current Folder browser.
Drop the variables in the Current Folder browser:
Create a MAT-file by dropping the variables onto any empty location in the Current Folder browser. Then name the file.
Update an existing MAT-file by dropping the variables onto the file name.
MATLAB warns you when the MAT-file contains variables of the same name. To update the existing variables, click Continue. Otherwise, click Cancel.
To suppress the warning, select File > Preferences > General > Confirmation Dialogs, and clear the preference, Confirm when overwriting variables in MAT-files.
See also Opening Files and Importing Data Using the Current Folder Browser.
| To... | Use This Function |
|---|---|
| Create a folder | mkdir |
| Create an M-file | edit |
| Create a MAT-file | save |
See also Locations for Storing Your Files.
Select the item to rename.
Right-click and select Rename from the context menu.
Type over the existing name with the new name. Warnings appear when:
The new name is invalid. Change the name to make it valid. See Naming M-files.
The folder is on the search path. See Making Changes to Folders on the Search Path.
Press Enter.
Use movefile.
To remove items:
Select the items to delete.
You cannot delete a folder while it is on the search path. See Making Changes to Folders on the Search Path.
Right-click and select Delete from the context menu.
When you delete a file or folder using the Current Folder browser, MATLAB permanently removes it or moves it to another location, based on your platform.
| Platform | Behavior Deleting Files and Folders Using the Current Folder Browser |
|---|---|
| Windows platforms | Follows the Windows system preference for sending files to the Recycle Bin. Some systems only allow recycling of local files and not files accessed on a network. To delete a selection permanently when the system preference is set to recycle, press Shift+Delete. |
| Linux platforms | Specify the behavior:
If you select to move files to a temporary folder, determine the location by running tempdir. To delete a selection permanently when the preference is set to recycle, press Shift+Delete. |
| Macintosh platforms | Follows your Macintosh system preference for sending files to the Trash. |
| To... | Use This Function |
|---|---|
| Delete a file | delete |
| Delete a folder | rmdir |
There is no opportunity to recover folders deleted using rmdir.
By default, the delete function permanently deletes files. To move them to a different location instead, use the Deleting files preference:
From any desktop tool, select File > Preferences > General.
Set the Deleting files option you want.
With the preference set to delete files permanently, delete runs faster.
To override the preference when using the delete function, use the recycle function.
The location for deleted files varies by platform.
| Platform | Location for Files Not Permanently Deleted Using the delete Function |
|---|---|
| Windows platforms | Recycle Bin. Some systems only allow recycling of local files and not files accessed on a network. |
| Linux platforms | MATLAB_Files_<day>-<mo>-<yr>_<hr>_<min>_<sec> folder in the location returned by the tempdir function. For example, when tempdir returns /tmp, files deleted at 2:09:28 in the afternoon of November 9, 2009 move to /tmp/MATLAB_Files_09-Nov-2009_14_09_28. |
| Macintosh platforms | Trash |
Deleted files remain in these locations until you remove them. To remove deleted files, use operating system features, such as Empty Recycle Bin on Windows platforms.
Copy and move files and folders using the Current Folder browser using standard GUI practices. For example, drag a file from one folder to another or to another application, such as Windows Explorer.
Using the Current Folder browser, you cannot move a folder that is on the search path. See Making Changes to Folders on the Search Path
To copy and move files and folders using functions, use copyfile and movefile.
![]() | Finding Files and Folders | Opening and Running Files Using the Current Folder Browser | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |