This function returns a safe valid MatLab variable name.

ValidName = Lib.Data.ValidName("Name")

ValidName:  (string) Returned valid variable name

Name:           (string) Input variable name

See MatLab Variables for a discussion on the topic.

Note that this function is always internally used when dealing with any MatLab variable name and data operations.

However, variable names used inside of an executed expression are not validated so you need to be aware of variable name issues.


Input:     Output:                Reason:

2a         a                Leading number is not allowed

FRED  fred                Lower case is always used

x         x                x is allowed but be aware that it can also be confused with the multiply operation

i         Error                i is a reserved word

Fix         Error                Fix is a reserved word                

SIN         Error                Sin is a reserved word

Big N         bign                Spaces are removed and lower case is used