Sudden error occurs on executing Matlab program
Show older comments
Dear all,
I wrote some Matlab programs (several M files and functions) and saved them in a folder. I successfully ran these programs after finised writting. However, after I surfed Internet for a while and got back to ran them again, there were strang errors. For example, when I ran a file called Test.m I wrote, it complains
??? Undefined function or variable 'Test'
And it happens to all other programs (within the same folder) as well. If I copy them to a different drive or different folder, the error still occurs to some of the programs.
Would you please tell me why this happened and how to solve it?
Many thanks and I look forward to your reply.
Sincerely, Jinlong.
Accepted Answer
More Answers (2)
David Young
on 3 Nov 2011
0 votes
Try changing the current MATLAB directory to the folder containing your M-files, or else adding that folder to your MATLAB path, using the addpath function or the path tool.
Jinlong Wei
on 4 Nov 2011
0 votes
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!