I have a script, called TESTSCRIPT. It was running fine since I created it several hours ago, but now whenever I try to run it, either by pressing F5 or using the command prompt, I get the error message
Undefined function or variable 'TESTSCRIPT'
TESTSCRIPT is in fact a solution to another script file that had suffered the same consequence. I have read through many people's MatLab Forum posts, and I have tried many, if not all, the solutions given:
- Checked, double checked, and triple checked the Matlab paths using
path,which TESTSCRIPT, andpwd. All return the correct paths. - Changed file and function names so that they wouldn't match any function or file I don't know about within the MatLab paths.
- Creating a new file, and copying the code. This provided a temporary solution, until now.
- Commented out all but the declaration of two variables. Still get the same error message.
- Changed computers. This didn't change anything.
The only thing that stood out when I did all these was when I typed which TESTSCRIPT and got <path>\MATLAB\TESTSCRIPT\TESTSCRIPT.m % Has no license available. I definitely do have a license, because I've been using it for the last 8-9 months without a problem.
I cannot put breakpoints within the code. When I try, a window pops up and says:
License Checkout failed.
License Manager Error -39
along with other stuff.
Scripts older than a week run fine when I hit F5. If I select a piece of code, within TESTSCRIPT, and run just that selection (by pressing F9), that runs without a problem.
My first thought was the file is corrupt, but then a new file would have worked, and this being the third time I've had to creat a new set of files, I'm confident it is not the case.
What is going on, and how do I solve this?
UPDATE
This seems to have resolved itself when I closed and opened MatLab. It does not explain why it has done this, but the problem seems to be solved.
TESTSCRIPTin the MATLAB installation hierarchy? You shouldn't. Your stuff should live in your home directory. Also, all-caps is likely to confuse things. The MATLAB convention is lower-case script and function names.dec2rad = 3.14159/180; pi = 3.1415924;Pressing F5 brings back the Undefined error.