isvarname
Tests if a string is a valid variable name.
Syntax
R = isvarname(A)
Inputs
- A
- The string to be tested to determine if it is a valid variable name.
Outputs
- R
- R is a logical value indicating whether A is a valid variable name. The variable does not have to be defined.
Examples
Simple
example:
a = 5;
R = isvarname('a')R = 1Undefined
example:
R = isvarname('b') % b is not definedR = 1Invalid
example:
R = isvarname('32x')R = 0