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.


Check validity of option

iptcheckstrs will be removed in a future release. Use validatestring instead.


out = iptcheckstrs(in, valid_strs, func_name, var_name, arg_pos)


out = iptcheckstrs(in, valid_strs, func_name, var_name, arg_pos) checks the validity of the option in. If the character vector matches one of the character vectors in the cell array valid_strs, iptcheckstrs returns the valid character vector in out. If the character vector does not match, iptcheckstrs issues a formatted error message. iptcheckstrs looks for a case-insensitive, nonambiguous match between in and the values in valid_strs.

valid_strs is a cell array of character vectors.

func_name specifies the name of the function doing the checking in the formatted error message.

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. iptcheckstrs converts this value to an ordinal number and includes this information in the formatted error message.


To trigger this error message, define a cell array of character vectors and pass in a character vector that isn't in the cell array.


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?