FUNCTION REFERENCE

genvarname

Construct a valid, unique variable name.

Construct a valid, unique variable name.

Syntax

name = genvarname(candidate); name = genvarname(candidate, protected)

Spaces are removed and the next letter capitalized, other invalid characters become 0xHH codes, an initial non-letter or a keyword gets an x prefix, and a number is appended until the name differs from protected names. A cell input gives a cell of mutually unique names.

Example

genvarname('my var')   % myVar

Differences from MATLAB: none known for these forms.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.