| MATLAB Function Reference | ![]() |
Determine if input is valid variable name
Syntax
Description
tf = isvarname 'str'
returns logical 1 (true) if the string str is a valid MATLAB variable name and logical 0 (false) otherwise. A valid variable name is a character string of letters, digits, and underscores, totaling not more than namelengthmax characters and beginning with a letter.
isvarname str
uses the MATLAB command format.
Examples
This one is not because it starts with a number:
If you are building strings from various pieces, place the construction in parentheses.
See Also
genvarname, isglobal, iskeyword, namelengthmax, is*
| isvalid (timer) | isvector | ![]() |
© 1994-2005 The MathWorks, Inc.