"You can save your function:
- In a function file which contains only function definitions. The name of the file should match the name of the first function in the file.
- In a script file which contains commands and function definitions. Functions must be at the end of the file. Script files cannot have the same name as a function in the file. Functions are supported in scripts in R2016b or later.
My question is twofold:
- Why the function file SHOULD have the same name as the first function in the file?
- Script files cannot have the same name as a function in the file? Why? What will go wrong?
Best Answer