LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab Script Node Error 1047

I have a function VI with a Matlab script node that has many inputs.  It runs well but if I when I go to add an additional input I get the Error 1047 occurred at LabVIEW:  LabVIEW failed to send variable to the script server. Server:"" in Simulator.vi.  If I remove the input, it runs again.  I'm trying to add 3 new inputs that are just real numbers (controls).  I can execute the Matlab script in the command window that pops up if I define the additional input variables.  

A separate part of my VI reads .mat files for plotting.  It also has inputs from Labview and it runs, although I haven't added any inputs to it.  I can run the Lorenz and Fractal examples so those previous solutions don't seem to work for me.  I don't think it has to do with Active X or registry files since it will run when I remove the additional inputs.  What else should I be looking at?  Thanks!

0 Kudos
Message 1 of 9
(4,265 Views)

Update: I made a new duplicate VI, starting from scratch, I can add all the inputs I want.  But I saved it, ran it, and now I can't add additional inputs OR outputs OR any other indicators or even just build a 2D constant array.  My VI waits for user input to run the Matlab script node.  Once the script node is initiated, I get the 1047 error if I have anything additional added.  I've tried to copy and paste everything onto a new VI with all the outputs I want but that did not work.  

0 Kudos
Message 2 of 9
(4,242 Views)

Hello inchieh,

 

Are you by chance running this in LabVIEW 2012?

 

Why Do I Get Server Script Error 1047 with My MATLAB® Script Node?

http://digital.ni.com/public.nsf/allkb/8BEBC0C86541224286257AF300561B5E?OpenDocument

Erin D.
0 Kudos
Message 3 of 9
(4,211 Views)

Hi Erin,

No, I'm running it in 2013 with Matlab R2009a.  Unfortunately my vi worked before and I was trying to add three more inputs to it.  Now, the outputs that worked before don't work.  I can run the script from the Matlab window that pops up so I know the variables exist, but when I add my Express Graph (even unwired), the Matlab script node doesn't even initialize.  It seems like I'm missing something simple...

0 Kudos
Message 4 of 9
(4,204 Views)

Let's double check that the ActiveX script server starts properly by following the steps here:

 

Why Do I Get Error 1047 When Trying to Use the MATLAB® Script Node in LabVIEW?

http://digital.ni.com/public.nsf/allkb/2B3FF46C8512C4F786256CF30071BE53?OpenDocument

 

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

Erin D.
0 Kudos
Message 5 of 9
(4,196 Views)

I tried those steps, no success.  If the script node runs when I delete the Express Graph, then Active X server is functioning properly right?

0 Kudos
Message 6 of 9
(4,190 Views)

It should be... can you upload an image of your block diagram so I can see how you have it set up in LabVIEW?

Erin D.
0 Kudos
Message 7 of 9
(4,171 Views)

The "offending" bit is the bar graph plotting in the lower right.  Once that is deleted, it runs and I get the other outputs displayed.  

All the input variables are "active", meaning if I run the VI, then make the case True to run the Matlab code, I get the 1047 error, but in the Matlab window that pops up, all the inputs have values.  However, the first line, changing directories, does not run even though 'directory' has a value (string).  So, if I stop the VI when I get the error, I can go to the Matlab window and copy the code that's in the script node and the script runs fine.  Once I delete all the bits associated with barGraph, including the constant array, it will run.  

Additionally, if I delete the barGraph part but add an extra line in the Matlab node - just c=1+2 - I will get the 1047 error, even if I did not ask for c as an output.  

As a side note, I made an alternate VI where I have the barGraph part inside a separate case structure so that going to the barGraph plot would basically end the while loop that has the inputs and that Matlab node.  If I manually run the script in the Labview window, I can then plot the barGraphs by bypassing the script node - this means to me there is nothing wrong with the output or form of the barGraph XY plot or constant array.

Thanks! 

0 Kudos
Message 8 of 9
(4,146 Views)

Hey,

 

I'm just jumping in on the conversation, but I'm not sure I understand exactly the behavior you're seeing. It sounds like if you build a new VI with a "MATLAB script node", the node works fine. but if after you've saved it you try to add new inputs or outputs, you receive error 1047, unless you remove certain other inputs.

 

If that's not what's happening, would you mind summing up what you're seeing? Thanks!

Britton C.
Senior Software Engineer
National Instruments
0 Kudos
Message 9 of 9
(4,113 Views)