Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

delete

Delete files or objects

Syntax

delete filename
delete filename1 ... filenameN
delete(h)
delete(handle_array)

Description

example

delete filename deletes filename from disk, without requesting verification. To change whether the specified file is permanently deleted or sent to the recycle bin, change the Delete files preference. To do so, go to the Home tab and in the Environment section, click Preferences. Select MATLAB > General and choose from one of the two options in the Delete files section. By default, the Delete permanently option is selected.

Note

On Mac platforms, the Delete files preference is not applied to files deleted from network drives. All files are deleted permanently.

delete filename1 ... filenameN deletes the specified files from disk.

example

delete(h) deletes the object h. If h is an array, then delete deletes all objects in the array.

delete(handle_array) is a method of the handle class. This syntax removes from memory the handle objects referenced by handle_array. For more information, see handle.delete.

Examples

collapse all

Delete all files in the current folder with a .mat extension.

delete *.mat

Delete a graphics object and a graphics object array.

Create a figure and an axes object, and then delete the axes. The axes object is deleted, but the figure remains. The axes variable ax remains in the workspace, but no longer refers to an object.

fig = figure;
ax = axes;
delete(ax)
display(ax)
ax = 

  handle to deleted Axes

Delete all the line objects created by plot.

H = plot(magic(5));
delete(H)

Input Arguments

collapse all

File name to delete, specified as a character vector. filename can be an absolute or relative path and can include wildcards (*).

Object to delete, specified as an object or an object array.

Introduced before R2006a

Was this topic helpful?