Documentation Center

  • Trial Software
  • Product Updates

iptcheckhandle

Check validity of handle

Syntax

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

Description

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

valid_types is a cell array of strings specifying the set of Handle Graphics object types to which H is expected to belong. For example, if you specify valid_types as {'uipanel','figure'}, H can be a handle to either a uipanel object or a figure object.

func_name is a string that specifies the name used in the formatted error message to identify the function checking the handle.

var_name is a string that 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.

See Also

| | | |

Was this topic helpful?