Sanjay Manohar
Sanjay Manohar

Reputation: 7026

Deleting a created axes in Matlab

How do I remove an axes object from a figure in Matlab? I created one using

haxis = axes('position', [0.1 0.1 0.8 0.8]);

Now I want to remove it! (i.e. not just hide the lines - actually delete the object?)

I tried cla but that just removes objects drawn in the axes.

clf will do it but also removes all other axes, which I need to keep.

Upvotes: 0

Views: 27

Answers (1)

Christopher Creutzig
Christopher Creutzig

Reputation: 8774

Fortunately, just saying what you want to do works:

delete(haxis)

I believe the same is true for other graphics handles.

Upvotes: 1

Related Questions