Undefined function or variable 'xyz'
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,friends
I have a problem with running m script.
I try to run the .m file in my current directory and Matlab would give the message - "Undefined function or variable". I add the current path and still it does not recognize any .m file in the current directory.
Moreover, any new .m file is not running at all, while some of the old .m files I executed previously are working fine.
So, I reinstalled MATLAB three times today. But still show the same problem.
Any help is most appreciated!
댓글 수: 3
Edmondo
2012년 7월 5일
I also am experiencing the same problem. Have you found any solution? In my case the function IS in the folder, but matlab says "Undefined function or variable 'main' "
Image Analyst
2012년 7월 5일
Does the word "main" show up at all in your m-file? If so, paste that code here, or better yet, start your own thread.
답변 (1개)
Oleg Komarov
2012년 3월 23일
Let's see what's the problem, unrecognised function or unrecognized variable (I admit these error messages should be rewritten):
% Make sure no variables in the workspace
clear
CASE 1 Inbuilt function, a not defined.
>> min(a)
Undefined function or variable 'a'.
CASE 2 Custom function NOT in the current directory or on any matlab path, input is defined.
>> myMin(1)
Undefined function 'myMin' for input arguments of type 'double'.
CASE 3 Custom function BUT a undefined (the input errors first)
>> myMin(a)
Undefined function or variable 'a'.
CASE 4 Case sensitive syntax, A is defined, a is NOT.
A = 1;
>> myMin(a)
Undefined function or variable 'a'.
댓글 수: 1
Michael Hixson
2019년 10월 20일
My problem is case 3
myfunction=(3*T/((8/10)-3*(8/1000))-(9*(8/100)/(T^(.5))*0.8*(0.8+8/1000)))
Unrecognized function or variable 'T'.
This was working using this exact code 10 minutes ago, I saved this syntax in a text file for later use and now when I try to use it I get this error. How is that when I just had it working fine? I changed nothing...
참고 항목
카테고리
Help Center 및 File Exchange에서 Programming Utilities에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!