LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab Script Inputs

I'm trying to run the example file "MATLAB Script - Lorenz Diff Eq.vi" and get the following error. Any idea why?

-----------------------------------
Error 1047 occurred at LabVIEW: LabVIEW failed to send variable to the script server.
Server:"Inappropriate input array sizeE" in MATLAB Script - Lorenz Diff Eq.vi

Possible reason(s):

LabVIEW: LabVIEW failed to send variable to the script server.
-----------------------------------

Also, when I run the example code from the help file in a separate vi:
a=rand(50)
surf(a)

it works fine, but when I add inputs and outputs to the same script, the inputs and outputs work, but it never draws the surface 'a' or seems to update 'a'.

Thanks for your help!
0 Kudos
Message 1 of 6
(4,412 Views)
Hello,
I get this same error with the example VI when I manually close the Matlab command window. In other words, when you open a VI that has a Matlab script node (or you place a node in a new diagram), LabVIEW automatically opens the Matlab command window to start the Matlab server to which LabVIEW sends the data and commands. If you close the window, or if LabVIEW is failing to open it successfully, then LabVIEW cannot send the data and commands to Matlab.

It seems like the error indicates lack of communication with Matlab, which can be because of the situation I described in the previous paragraph, or for some other reason which I don't know. Possibilities that come to mind is that the Matlab server is not installed correctly, or maybe disabled or someth
ing like that.
0 Kudos
Message 2 of 6
(4,412 Views)
Alejandro,

Thanks for your help. When I run the sample code for the rand() and surf() functions, Matlab runs the code properly, opens a new figure to display it, updates dynamically and even outputs the variable 'a' back to Labview correctly.

So, outputs seem to work fine, but I haven't been able to get any inputs to work. So that leads me to believe that the Matlab server is working (as it can crunch code and send back data), but perhaps it's not enabled to take an input or I'm trying to pass the input improperly.

Is there any trick to send an input to Matlab? In other words, if I send a constant, for example, the number '2' to Matlab, I wire a constant '2' to the input on the Matlab VI block and then set the data type as 'Real', and I get the
error.

Does the error have to do with the array size (as it claims, even though I'm trying to pass in a single real constant, not an array...), or is it really a communication error as you suggest? Thanks for your help!

Neville
0 Kudos
Message 3 of 6
(4,412 Views)
Hello,

This problem stem from a couple of sources.

First, look at the KnowledgeBase entry titled LabVIEW 6.x and Earlier Does Not Interface Properly with MATLAB 6.1 or MATLAB 6.5. This outlines the procedure for fixing the interface problems.

A similar issue has recently surfaced with Matlab 7.0 and LabVIEW 7.x. R & D is aware of the problem and they are currently working on a solution. Unfortunately, if this is your situation, the only immediate fix it to downgrade your version of Matlab.

I hope that this helps.

Regards,
P.J.
National Instruments
0 Kudos
Message 4 of 6
(4,412 Views)
P.J.,

Thanks for answering my question. I have Matlab 7.0 and LabVIEW 7.1.

Do I have to reinstall Matlab to downgrade it, or can I just replace the current file with the matscript.dll file that was attached to the KB entry to which you referred me?

Also, what is the timeline on fixing this bug? I'm trying to evaluate the capabilities of Matlab and Labview and make a decision in the next few days whether our lab will use Matlab or Labview for our DAQ needs.

The fact that this bug came up before in earlier versions of Matlab/Labview isn't exactly encouraging...

Thanks.

Neville
0 Kudos
Message 5 of 6
(4,412 Views)
In order to keep any further discussion on this topic in a single location, please refer to this thread for more information.
0 Kudos
Message 6 of 6
(4,412 Views)