delete

Deletes the file(s), f, or a graphic object, h.

Syntax

delete(f)

delete(f1, f2...)

delete(h)

Inputs

f
Name(s) of files to be deleted. Wild cards such as '*' can be used to delete multiple files in a single command.
Type: string
h
Handle of the graphic object to be deleted.
Type: double
Dimension: scalar

Examples

Delete a file:
fname = 'D:/Tests/FileManipulation/CreatedFile.txt'
delete(fname)
Delete a graphic object:
clear all; close all;
lh1 = plot(rand(10,1));
lh2 = line(1:10,rand(10,1));
delete(lh1)

Comments

Regarding graphic objects, delete may be used to delete line, surface, axes, text, shape, or uicontrol objects from a figure. The child objects of the deleted object are also deleted. Certain objects, such as the title, x label, y label, and z label, cannot be deleted. A figure can be deleted by using the close command.