namelengthmax
Maximum length of a variable, function or field name.
Category: Programming > Functions
Syntax
N = namelengthmax
Returns the longest name length that is accepted.
Description
Identifiers longer than namelengthmax characters are not valid. Code that generates names programmatically, for example from table headers or file names, can compare against this value or truncate to it. matlab.lang.makeValidName applies the limit automatically.
Output arguments
N- Double scalar with the limit,
63.
Example
Reading the limit
N = namelengthmax
name = repmat('a', 1, N + 5);
name = name(1:N);
disp(isvarname(name))
Output
N = 63
1
See also
isvarname matlab.lang.makeValidName mustBeValidVariableName genvarname