02-26-2010 12:57 PM
Hi everyone. I am running a MatLab (2007) script node in my VI (LabVIEW 8.2) and I am getting an error whenever I run the VI. The error is:
Error 1048 occurred at LabVIEW: LabVIEW failed to get variable from the script server. Server:"??? Undefined function or variable 'volt_out'.
volt_out is defined in my code so I don't understand why I keep getting the error. I attached my MatLab script. Any thoughts on this would be appreciated. Thanks for the help.
02-28-2010 11:16 PM
03-01-2010 12:34 PM
Thank you for your response. I actually already looked at the link you sent me and their explanation of the cause of the error is not my problem.
1. The variable name volt_out is not the same as a function name in MatLab
2. I am not using the clear all function in my script.
3. I am not utilizing a function such as "input" that requires interaction with the command window.
Any thoughts as to what is going on?
Thank you for the help.
03-01-2010 04:05 PM
Hi baseball07,
Are you able to run the script directly in MATLAB?
05-30-2010 08:35 PM
06-02-2010 10:02 AM
Hi baseball07,
To go back to Kyle's question, are you able to run this same script in MATLAB? Have you tried dropping down a new MATLAB Script Node and copy/pasting your script into that one? Have you tried starting from a blank script and incrementally building and testing your script?
Aaron P
National Instruments
Applications Engineer
10-22-2010 03:16 AM
I have the exact same problem. The script is working in Matlab. Any thoughts?
10-25-2010 09:35 AM
To go back to what Aaron was saying, did you import or copy/paste the script into the node? How about taking portions of the code and slowly building your script in the MathScript node.
10-26-2010 01:06 AM
Hi Stephanie,
Thanks for the reply. It works now. At the beginning of my function i used a relative path and the current directory was not set properly. The reason that i got confused was that I got an error message saying "Undefined function or variable". The reason for this was that I had an "return" statement inside an if such that the function was quited before my variable was set. It is always more than one error 🙂
Another thing that confused me was that you have to re-open the vi after you make changes in the Matlab script. I guess Labview make a copy of the m-file when opening ?
Best regards
Marius
02-05-2013 09:44 AM
Hi. I got the same problem. what does it mean, you said “The reason for this was that I had an "return" statement inside an if such that the function was quited before my variable was set”?