Azzera filtri
Azzera filtri

Sudden error occurs on executing Matlab program

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Jon
Jon il 3 Nov 2011
Make sure the folder they are in is in the MATLAB search path.
File > Set Path ...

Più risposte (2)

David Young
David Young il 3 Nov 2011
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
Jinlong Wei il 4 Nov 2011
Dear Jon and David,
Thanks for your suggestions. However, seems the problem is more strang, as I used the addpath function and the path commend shows the directory has already been added in but the same problem still there!
Also, I have another parallel folder where the programs I wrote can run without any problem! You may suggest me to put the programs in that parallel folder. Yes I did it but the problem is the same. My computer adminstrator has installed a new version Matlab for me, however, the problem is not solved.
Really get surprised on what happened.
Thanks.
Jinlong.

Categorie

Scopri di più su Search Path in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by