Functions defined using keyword "function" must be defined within a file, not at the command line.
Function defined in "function file"
Often, you
store a function in its own file. In that case, the best practice is to use the same name
for the function and the file.
Function defined in "script file"
"Starting in R2016b, another option for storing functions is to include them at the end
of a script file."