If any statements, even empty statements, precede a function definition, MATLAB considers the file a script. Empty statements include a comma or semicolon appearing outside of a comment and before a function definition. If MATLAB considers the file a script, any functions defined in the file are local functions. You cannot call local functions from other files or from the command line.
If you intend for the file to be a function file, such that the first function is the main function, remove any statements above the function definition.