Script Written in The MathWorks, Inc. MATLAB® Language Syntax Returns Error 1048

Updated May 1, 2018

Reported In

Software

  • LabVIEW

Other

The MathWorks, Inc. MATLAB® Language

Issue Details

I am building a LabVIEW application which uses a script written in The MathWorks, Inc. MATLAB® language syntax. When I run my VI, I receive the following error : "Error 1048 occurred at LabVIEW: LabVIEW failed to get variable from the script server." Why do I receive this error?

Solution

This error can occur if your variable name is the same as a function name in the MATLAB development environment. For instance, using the variable name disp and then trying to return this variable will generate this error. To fix this, choose variable names that are not reserved names used by the MATLAB development environment. See the MATLAB online help or user manual for a list of reserved function names.

This error can also be generated if the Clear All function is used in your script. To resolve the error, simply remove this function from your script. For more information on creating and using scripts in LabVIEW using the MATLAB® language syntax, refer to LabVIEW's VI, Function, & How-To Help.

Commands such as input require the user to interact in the command window of MATLAB. They will not properly run in the MATLAB Script Node in LabVIEW. The following is a screenshot of a MATLAB Script Node that calls the input command.


To fix this problem, associate the variable being assigned the input to a LabVIEW control input on the Script Node

MATLAB® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.

WAS THIS ARTICLE HELPFUL?

Not Helpful