1

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, and pwd. 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.

6
  • 1
    This probably answers your issue: mathworks.com/matlabcentral/answers/… Commented Mar 18, 2015 at 14:32
  • @Daniel Thanks. From what I gether in that link, you have to rename the script file to something that doesn't clash with another function or script file already embedded within Matlab, and I've already tried that. Commented Mar 18, 2015 at 14:46
  • Could you try to provide a minimal example which reproduces the problem? Commented Mar 18, 2015 at 15:04
  • Did you make a directory TESTSCRIPT in 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. Commented Mar 18, 2015 at 15:37
  • @Daniel Here is the minimal example code: dec2rad = 3.14159/180; pi = 3.1415924; Pressing F5 brings back the Undefined error. Commented Mar 18, 2015 at 16:19

1 Answer 1

0

Both dec2rad and pi are builtin functions, rename both variables to avoid the error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.