handle.isvalid - Determine valid handles - MATLAB (original) (raw)

Main Content

Class: handle

Description

[B](#bul3u21-1-B) = isvalid([H](#bul3u21-1-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. Within a class delete method, isvalid always returns false.

You cannot override the isvalid method in handle subclasses.

Input Arguments

expand all

Input array, specified as an array of object handles.

Output Arguments

expand all

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.

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)

Extended Capabilities