ishandle - Test for valid graphics object handle
Syntax
ishandle(H)
Description
ishandle(H) returns anarray whose elements are 1 where the elements of H arevalid graphics or Sun Java objecthandles, and 0 where they are not.
Non-Graphics Object Handles
Use the isa functionto determine the class of MATLAB objects and use the isvalid handleclass method to determine the validity of handle objects. See Testing Handle Validity forinformation on testing for MATLAB handle objects.
Examples
Ensure that an input argument is the handle to a graphics object.
function updateLine(h,x,y) if ishandle(h) set(h,'XData',x,'YData',y) ... else line('XData',x,'YData',y); ... end end
isvalid (handle) - Is object valid handle class object
Syntax
Hl = isvalid(Hobj)
Description
Hl = isvalid(Hobj) returns a logical array(or scalar if Hobj is scalar) in which each elementis true if the corresponding element in Hobj isa valid handle. This method is Sealed, so you cannotoverride it in a handle subclass.