isvarname
Determine if input is valid variable name
Syntax
Description
tf = isvarname(
determines if inputs
)s
is a valid variable name. Ifs
is a valid MATLAB®variable name theisvarname
function returns logical1
(true
). Otherwise it returns logical0
(false
).
A valid variable name begins with a letter and contains not more thannamelengthmax
characters. Valid variable names can include letters, digits, and underscores. MATLAB keywords are not valid variable names. To determine if the input is a MATLAB keyword, use theiskeyword
function.
isvarname
is the command form of the syntax. The command form requires fewer special characters. You do not need parentheses or single quotes around the input.s