This is machine translation

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

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Delete files or objects


delete('fileName1', 'filename2', ...)
delete fileName


delete('fileName1', 'filename2', ...) deletes the files fileName1, fileName2, and so on, from the disk. fileName is a character vector and can be an absolute path or a path relative to the current folder. fileName also can include wildcards (*).

delete fileName is the command syntax. Delete multiple files by appending filenames, separated by spaces. When filenames contain space characters, you must use the function form.

delete(h) deletes the graphics object h. If h an array, the function deletes all objects in the array. h can also contain the figure Number.

The function deletes objects without requesting verification, even if when the objects are figure windows.

delete(handle_array) is a method of the handle class. It removes from memory the handle objects referenced by handle_array.

When deleted, any references to the objects in handle_array become invalid. To remove the handle variables, use the clear function.

As delete does not ask for confirmation, to avoid accidentally losing files or graphics objects, be sure to specify accurately the items to delete. To move files to a different location when running delete, use the General preference for Deleting files, or the recycle function.

The delete function deletes files and graphics objects only. To delete folders, use rmdir.


Delete all files with a .mat extension in the /mytests/ folder:


Create a figure and an axes, and then delete the axes:

fig = figure;
ax = axes;
The axes is deleted, but the figure remain. The axes variable ax remains in the workspace, but no longer refers to an object.

Use an array to delete all the line objects created by plot:

H = plot(magic(5));

Pass the array H to delete:


See Also

| | |

Introduced before R2006a

Was this topic helpful?