MATLAB: Command Window cannot access custom Functions defined in end of Matlab Script

functions

Hi,
I have defined custom Functions that can be accessed by code within the Script. However, calling the function from the Command Window returns "Unrecognized function or variable". Any recommendation to rectify this?
Thanks,
Sujith

Best Answer

Functions defined at the end of a script or function file are called local functions. By design, these cannot be accessed outside the file in which they were defined. If you want to create a function you can call from any script or function. you must place just that function in a file all by itself. Convention dictates that the function name and filename should be the same.
You can learn more about functions here.