Main Content

isgraphics

True for valid graphics object handles

Description

example

tf= isgraphics(H)returnstruefor elements ofHthat are valid graphics objects andfalsewhere elements are not valid graphics objects or are graphics objects that have been deleted.

tf= isgraphics(H,type)returnstruefor elements ofHthat are valid graphics objects of the type specified by thetypeargument. An object type is the value contained in the object’sTypeproperty.

Examples

collapse all

Create a plot and return the handle array. Test array for valid handles.

H = plot(rand(5));

Figure contains an axes object. The axes object contains 5 objects of type line.

isgraphics(H)
ans =5x1 logical array1 1 1 1 1

Create a plot and return the handle array. Concatenate with other graphics objects and test for handles that are of typeLine.

H = plot(rand(5));

Figure contains an axes object. The axes object contains 5 objects of type line.

a = [H;gca;gcf]; isgraphics(a,'line')
ans =7x1 logical array1 1 1 1 1 0 0

Input Arguments

collapse all

Input variable or expression that evaluates to graphics object handles.

Object type, specified as a character vector or string scalar. An object’s type is the value of itsTypeproperty.

Output Arguments

collapse all

Result, returned as a logical array. Values of1indicate elements of the input array that are valid, and values of0indicate elements that are invalid. The result is an empty array when the input array is empty.

已经rsion History

Introduced in R2014b

See Also

Functions