This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Test for Valid Handle

Use isgraphics to determine if a variable is a valid graphics object handle. A handle variable (h in this case) can still exist, but not be a valid handle if the object to which it refers has been deleted.

h = plot(1:10);
...
close % Close the figure containing the plot
whos
Name      Size            Bytes  Class                       Attributes

  h       1x1             104    matlab.graphics.chart.primitive.Line 

Test the validity of h:

isgraphics(h)
ans =

     0

For more information on deleted handles, see Deleted Handle Objects.