How to resolve Undefined function or variable error?
Ältere Kommentare anzeigen
Hi,
I had completed my project. That was working fine on another computer. When copied it on my laptop. It starts giving error on every function i defined. Giving "Undefined function or variable" error.
So how to resolve this issue? What is the possible solution for this cause?
8 Kommentare
KSSV
am 12 Dez. 2018
Are both MATLAB versions same? Did you copy all the required functionns which your code uses?
Manzoor Hussain
am 12 Dez. 2018
KSSV
am 12 Dez. 2018
The required files are in the same folder? Or if in different folder, are they added in path?
Manzoor Hussain
am 12 Dez. 2018
KSSV
am 12 Dez. 2018
Can you show us the code? It should not show such errors..
Manzoor Hussain
am 12 Dez. 2018
Bearbeitet: per isakson
am 12 Dez. 2018
Adam Danz
am 13 Dez. 2018
As mentioned above by others, one of the following circumstances is probably causing the error.
- You are missing a function.
- You are not missing a function but the function is not on the matlab path.
- You are missing an entire toolbox
- You're using a different version of matlab that lacks a function.
- Perhaps one version uses a global variable that isn't declared in the other version.
You provided your code but you didn't tell us what line is causing the error. If you include the full error message that will be helpful.
Walter Roberson
am 13 Dez. 2018
Bearbeitet: Walter Roberson
am 13 Dez. 2018
It starts giving error on every function i defined
The location you copied the files into is not your current directory and is not on your MATLAB path. Use pathtool to add the directory to your path.
There is one other alternative: you might have defined the functions with a file name in a different case (upper / lower case) than the name of the function, and the file system you were using originally was not case sensitive, but the new file system is case sensitive. For example NTFS filesystems are not typically set to be case sensitive, so RDsamp.m would be considered the same file as rdsamp.m, but Linux filesystems usually are case sensitive, so RDsamp.m would not be looked for when looking for function rdsamp
Antworten (0)
Kategorien
Mehr zu Environment and Settings 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!