This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

iptcheckconn

Check validity of connectivity argument

Syntax

iptcheckconn(conn,func_name,var_name,arg_pos)

Description

example

iptcheckconn(conn,func_name,var_name,arg_pos) checks whether conn is a valid pixel connectivity argument.

  • If the connectivity argument is valid, then iptcheckconn returns nothing. Valid connectivities are one of these scalar values: 1, 4, 6, 8, 18, or 26. A connectivity argument 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 argument is invalid, then the function 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 argument is valid.

Examples

Check Validity of 4-by-4 Matrix

Create a 4-by-4 array and pass it as the connectivity argument.

iptcheckconn(eye(4),'myfun','myvar',2)

eye(4) is not a valid pixel connectivity so iptcheckconn returns an error message:

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

Introduced before R2006a