LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1048 occurred at LabVIEW: LabVIEW failed to get variable from the script server. Server:"??? Undefined function or variable 'volt_out'.

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.Script.JPG
0 Kudos
Message 1 of 10
(11,006 Views)

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.

0 Kudos
Message 3 of 10
(10,972 Views)

Hi baseball07,

 

Are you able to run the script directly in MATLAB? 

Message 4 of 10
(10,956 Views)
The MatLab code seems to be ok.  I think it is a problem with interfacing with LabVIEW.  I still cannot figure out what it could be.  Are there any more suggestions?  Thank you.
0 Kudos
Message 5 of 10
(10,761 Views)

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

http://www.ni.com/support

0 Kudos
Message 6 of 10
(10,696 Views)

I have the exact same problem. The script is working in Matlab. Any thoughts?

0 Kudos
Message 7 of 10
(10,453 Views)

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.

Stephanie A.
Americas Marketing Manager
National Instruments
0 Kudos
Message 8 of 10
(10,423 Views)

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

0 Kudos
Message 9 of 10
(10,412 Views)

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”?

0 Kudos
Message 10 of 10
(9,380 Views)