Documentation

This is machine translation

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

iptcheckhandle

Check validity of handle

Syntax

iptcheckhandle(obj, valid_types, func_name, var_name, arg_pos)

Description

iptcheckhandle(obj, valid_types, func_name, var_name, arg_pos) checks the validity of the object obj and issues a formatted error message if the handle is invalid. obj must be a single figure, uipanel, hggroup, axes, or image object.

valid_types is a cell array of character vectors specifying the set of MATLAB® graphics object types to which obj is expected to belong. For example, if you specify {'uipanel','figure'}, obj can be a handle to either a uipanel object or a figure object.

func_name specifies the name used in the formatted error message to identify the function performing the check.

var_name specifies the name used in the formatted error message to identify the argument being checked.

arg_pos is a positive integer that indicates the position of the argument being checked in the function argument list. iptcheckhandle converts this value to an ordinal number and includes this information in the formatted error message.

Examples

To trigger the error message, create a figure that does not contain an axes object and then check for a valid axes handle.

fig = figure; % create figure without an axes
iptcheckhandle(fig,{'axes'},'my_function','my_variable',2)

The following shows the format of the error message and indicates which parts you can customize using iptcheckhandle arguments.

Introduced before R2006a

Was this topic helpful?