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.
Type: string
Dimension: string

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 = 1
Undefined example:
R = isvarname('b') % b is not defined
R = 1
Invalid example:
R = isvarname('32x')
R = 0