Main Content

iptcheckconn

Check validity of connectivity argument

Description

iptcheckconn(conn,func_name,var_name,arg_pos) checks if conn is a valid pixel connectivity and issues a formatted error message if the connectivity is invalid.

  • If the connectivity is valid, then iptcheckconn returns nothing. Valid connectivities are one of these scalar values: 1, 4, 6, 8, 18, or 26. A connectivity can also be a 3-by-3-by- ... -by-3 array of 0s and 1s. The central element of a connectivity array must be nonzero and the array must be symmetric about its center.

  • If the connectivity is invalid, then iptcheckconn issues a formatted error message that includes information about the function name (func_name), the variable name (var_name), and the argument position (arg_pos). These values are used only to create the error message, not to check whether the pixel connectivity is valid.

example

Examples

collapse all

Create a 4-by-4 array and pass it as the connectivity argument. eye(4) is not a valid pixel connectivity so iptcheckconn returns an error message:

iptcheckconn(eye(4),'myfun','myvar',2)
Function MYFUN expected input number 2, myvar, to be a valid connectivity specifier. A nonscalar
connectivity specifier must be 3-by-3-by- ... -by-3.

Input Arguments

collapse all

Pixel connectivity to check, specified as a numeric scalar or array.

Data Types: double | logical

Function name to include in an error message when conn is an invalid pixel connectivity, specified as a character vector or string scalar.

Data Types: char | string

Variable name to include in an error message when conn is an invalid pixel connectivity, specified as a character vector or string scalar.

Data Types: char | string

Argument position to include in an error message when conn is an invalid pixel connectivity, specified as a numeric scalar.

Extended Capabilities

Version History

Introduced before R2006a