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

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 5월 31일
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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

태그

질문:

2020년 5월 31일

댓글:

2020년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by