validatestring
Check validity of text
Syntax
Description
checks the validity of matchedStr = validatestring(str,validStrings)str against validStrings. The text is valid if it is an unambiguous, case-insensitive match to any element in validStrings. The validatestring function supports partial matching of leading characters.
If str is valid, then validatestring returns the matched text. Otherwise, MATLAB® throws an error.
includes the position of the input in your function argument list as part of any generated error messages. Use this syntax to format any generated error messages.matchedStr = validatestring(str,validStrings,argIdx)
includes the specified function name in generated error identifiers.matchedStr = validatestring(str,validStrings,funcName)
includes the specified variable name in generated error messages. Use this syntax to format any generated error messages.matchedStr = validatestring(str,validStrings,funcName,varName)
includes the position of the input in your function argument list as part of any generated error messages. Use this syntax to format any generated error messages.matchedStr = validatestring(str,validStrings,funcName,varName,argIdx)
Examples
Input Arguments
Output Arguments
Extended Capabilities
Version History
Introduced in R2006b