Main Content

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
Name      Size            Bytes  Class                       Attributes

  h       1x1             104 

Test the validity of h:

ans =


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