필터 지우기
필터 지우기

command window does not recognize the functions in editor

조회 수: 18 (최근 30일)
Shubhangi Singh
Shubhangi Singh 2020년 7월 12일
댓글: Shubhangi Singh 2020년 7월 12일
The two functions defined in editor and saved in C:\Users\SONY VAIO\Documemts\'function name'.
But when the function is called in command window it shows the error, Undefined Function. Neither can it recognize the variables used in the function. how should I so;ve the error?
  댓글 수: 2
madhan ravi
madhan ravi 2020년 7월 12일
which function_name -all % that is the path of your function , see if it’s under the directory you are working in
Stephen23
Stephen23 2020년 7월 12일
편집: Stephen23 2020년 7월 12일
"command window does not recognize the functions in editor"
There is no reason why it should: the files that are open in the MATLAB Editor can be saved in any location accesible to your OS user account, whereas the functions that can be run must be on the MATLAB Search Path or in the current directory.
Learn about the Search Path:

댓글을 달려면 로그인하십시오.

채택된 답변

John D'Errico
John D'Errico 2020년 7월 12일
I think you need to learn about the MATLAB search path.
While the editor can save a file anywhere you tell it to, when executing functions that you will create, MATLAB itself looks only in places you designate for that. Of course, it cannot search over your entire disk, as that would be far too large a place. That would make MATLAB run far too slowly. So you must tell MATLAB where to look for the files you wish to use.
The best way to do this is by using pathtool. It allows you to add a directory to your serch path. Don't forget to save the path, so the next time you open MATLAB, it will remmber that directory.
  댓글 수: 1
Shubhangi Singh
Shubhangi Singh 2020년 7월 12일
After using pathtool the fumctions worked successfully. Thank you for the help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by