Documentation

isvalid

Class: handle

Determine valid handles

Syntax

B = isvalid(H)

Description

B = isvalid(H) returns a logical array in which each element is true if the corresponding element in H is a valid handle. A handle variable becomes invalid if the object has been deleted.

You cannot override the isvalid method in handle subclasses.

Input Arguments

collapse all

H — Input arrayhandle array

Input array, specified as an array of object handles.

Output Arguments

collapse all

B — Result of validity testlogical

Result of validity test, returned as a logical array the same size as H in which each element is true if the corresponding element in H is a valid handle.

Attributes

Accesspublic
Sealedtrue

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

Test for Valid Handles

This example tests a handle array for valid members:

H = plot(rand(5));
delete(H(3:4))
B = isvalid(H)
B =

     1
     1
     0
     0
     1
Was this topic helpful?