MATLAB Function Reference    
isvarname

Test if string is a valid variable name

Syntax

Description

isvarname 's' returns a 1 if string, s, is a valid MATLAB variable name. Returns 0, otherwise. A valid variable name is a character string of letters, digits, and underscores, totaling not more than 32 characters and beginning with a letter.

R = isvarname('s') returns a 1 in R if string, s, is a valid variable name.

Examples

You can use isvarname without parenthesis if you pass a single string argument. If you are building strings from various pieces, place the construction in parenthesis.

See Also

iskeyword, is*


 isvalid j