LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1048 - Matlab script node

Solved!
Go to solution

Hi everyone

 

I realise that there are a lot of posts on dealing with error 1048 messages: I've scoured them all, in vain unfortunately.

 

I need to numerically invert the sinc function (sinc(x) = sin(x)/x), and I'd like to call a Matlab kernel to do so. However, after inserting the Matlab script code into my Block diagram and defining the inputs/outputs, LabVIEW returns the following:

 

Error 1048 occurred at LabVIEW: 'LabVIEW failed to get variable from the script server. Server: "1 1 0 0 0" in Untitled 1, 

Possible reason(s):

LabVIEW: LabVIEW failed to get variable from the script server.'

 

As I said, I've searched the forums: after looking at the suggestions on https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019NZGSA2&l=en-ZA, I'm sure I'm not using pre-defined function names, not using the clearall function, not requiring user input. I created the simple VI myself (i.e. didn't copy and paste it from anywhere), and the code runs perfectly in Matlab itself. The Lorenz Diff. Eq.vi example also runs perfectly, which is leads me to believe that LabVIEW is actually interfacing with Matlab fine in general. However, after building up the Matlab code little by little, I see that the error emerges only after I add the Matlab 'vpasolve' function to the Matlab script node. Before adding it, for simpler programmes, my VI works fine. This leads me to believe that LabVIEW doesn't seem to like the Matlab vpasolve function much, but I don't see why at all.

 

Attached is a VI, 'Untitled 1', which gives me the error, along with a screenshot of the error message itself. I'm running LabVIEW 2015 (32-bit) (the 32-bit version, since I'm told we seem to have problems in our laboratory interfacing with older equipment if we use a 64-bit version, although I wonder if this could be the cause?), and Matlab R2017a.

 

Any help would be greatly appreciated guys. Thanks!

 

Nick

 

P.S.: I realise that I could create a look-up table, but 1) I'd like a little bit more accuracy than a look up table generally allows, and 2) I'm curious to know what the problem is, even if there are ways around it.

Download All
0 Kudos
Message 1 of 3
(2,290 Views)
Solution
Accepted by topic author nickbman

I don't have the Symbolic Toolbox installed on this PC, and I don't generally use it, so perhaps this is rubbish, but...

Shouldn't "sol" be your output variable?

 

Edit: managed to get onto my workstation remotely and checked, changing "varX" to "sol" at the output node makes it work for me (LabVIEW 32-bit, 2019, MATLAB 2018b).


GCentral
0 Kudos
Message 2 of 3
(2,243 Views)

Hi cbutcher

 

Thank you so much for your help! Indeed, that was the error 🙂

 

I've noticed that, even after setting 'sol' to be the output variable instead of the erroneous 'varX' I had before, if one removes the 'double' function around vpasolve, then one gets an identical error 1048 message. I know I previously did indeed try setting the output variable to 'sol' while trying to debug, but I had simultaneously removed the 'double' function and got the same error message, hence I probably thought that setting the output variable to 'varX' wasn't the issue. I guess while trying to debug, I didn't simultaneously set the output to 'sol' and have the double function present. Silly me 😕

 

Thanks again for you help!

0 Kudos
Message 3 of 3
(2,227 Views)