Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

isgraphics

True for valid graphics object handles

Syntax

tf = isgraphics(H)
tf = isgraphics(H,type)

Description

example

tf = isgraphics(H) returns true for elements of H that are valid graphics objects and false where elements are not valid graphics objects.

tf = isgraphics(H,type) returns true for elements of H that are valid graphics objects of the type specified by the type argument. An object type is the value contained in the object’s Type property.

Examples

collapse all

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

H = plot(rand(5));

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

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

H = plot(rand(5)); 

a = [H;gca;gcf]; 
isgraphics(a,'line')
ans = 7x1 logical array
   1
   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. An object’s type is contained in its Type property.

Output Arguments

collapse all

Result, returned as a logical array or an empty GraphicsPlaceholder array. If the result is a logical array, 1 indicates elements of the input array that are valid, and 0 indicates elements that are invalid. The result is an empty GraphicsPlaceholder array when the input array is empty.

See Also

Functions

Introduced in R2014b

Was this topic helpful?