Programming and Data Types    

Function Names

MATLAB function names have the same constraints as variable names. MATLAB uses the first 31 characters of names. Function names must begin with a letter; the remaining characters can be any combination of letters, numbers, and underscores. Some operating systems may restrict function names to shorter lengths.

The name of the text file that contains a MATLAB function consists of the function name with the extension .m appended. For example,

If the filename and the function definition line name are different, the internal name is ignored.

Thus, while the function name specified on the function definition line does not have to be the same as the filename, we strongly recommend that you use the same name for both.


 Basic Parts of a Function M-File How Functions Work