MATLAB uses files to store numeric and graphical results, and MATLAB functions and code may be contained in files as well. Delete files in the default file path -- the "MATLAB" folder in your user "Documents" directory in a typical Windows installation -- or elsewhere using the "delete" command, or with the file browser in the MATLAB desktop.
Launch MATLAB and choose a file to delete. To quickly create a new file to work with, type the following command into the Command Window:
Use the "delete" command to delete a file programmatically:
Specify the whole path of the file (e.g.,"C:...") if it isn't in the MATLAB default path. Delete multiple files using the following syntax:
Right-click a file in the "Current Directory" browser and choose "Delete" from the drop-down menu to delete the file using the MATLAB interface.
Tips & Warnings
- Use the asterisk as a wild-card character to delete many files at once. For example, to delete several files whose names start with "testfile," use the following command:
- delete testfile*