What is the cause of undefined variable or function error.
Ältere Kommentare anzeigen
Hello and a good day. I just wanna ask a question about 'undefined variable or function' error.
i got an error saying
"Undefined variable or function Target might refer to the function target."
I'm just curious. What is the main cause of this type of error ?
Because, previously my function worked just fine and i haven't change a thing and suddenly this error popped up. Thanks in advance...
Antworten (1)
Matt Fig
am 12 Okt. 2012
MATLAB is case sensitive. Target, target, tarGet, TarGet are all different things. If your function is named target, don't call it as Target.
clear all
Tar = 6;
TAR = 7;
tar = 8;
whos
9 Kommentare
tarmizi adam
am 12 Okt. 2012
Walter Roberson
am 12 Okt. 2012
which -all Target
See if it is on your path.
Try executing
rehash
tarmizi adam
am 12 Okt. 2012
tarmizi adam
am 12 Okt. 2012
Walter Roberson
am 12 Okt. 2012
Ah, okay then what it is telling you is that at the point where fileOpen is being used (not the point it is being initialized), fileOpen does not exist. We would need to see the code between the two points to explain what is going on.
tarmizi adam
am 12 Okt. 2012
Walter Roberson
am 12 Okt. 2012
You have if, elseif, but if neither condition is true then fileOpen is left undefined.
tarmizi adam
am 12 Okt. 2012
tarmizi adam
am 12 Okt. 2012
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!