Why Command Window cannot access custom Functions defined in end of Matlab Script?

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

 Risposta accettata

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.

Più risposte (0)

Categorie

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by