LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error produced when trying to pass variables to a Matlab script

For some reason, LabVIEW produces an Error 1047 (Unable to pass variable to the script server) whenever I create an input variable to a Matlab code block.

Outputs work fine (for example, connecting an output "a" to a Matlab code block that says "a=rand(50)" correctly produces a 50x50 array of random numbers that can be displayed in LabVIEW). However, creating any kind of input node, whether or not the associated variable is mentioned in the MATLAB script, brings up an error 1047.

Any ideas what could be causing this? I'm using LabVIEW 7.0 and MATLAB 7 (R14). I've read the article
>here
and that's not the problem, and I've also updated my matscript.dll to the latest version, 7.0.0.2, which also made no difference.
0 Kudos
Message 1 of 5
(3,419 Views)
Between MATLAB 6.5.1 (R13.1) and 7.0 (R14), the Mathworks changed the behavior of the COM interface to MATLAB. The LabVIEW MATLAB Script Node uses the R13.1 compatible behavior. The problem is with passing real values to R14. Complex values work correctly.

Workaround: Change the types of input terminals of the MATLAB Script Node to complex datatypes.

Solution: NI will post a KnowledgeBase article with a permanent solution when it is developed.

Jon Bowers
Applications Engineer
NI UK
0 Kudos
Message 2 of 5
(3,419 Views)
Hi Ian,

Could you contact NI UK Tech support on 01635 572410 (ask for me) or post your email address because we have some more information on a fix for this MATLAB script error.

Jon Bowers
Applications Engineer
NI UK
0 Kudos
Message 3 of 5
(3,419 Views)
For what its worth,

I work in a company with a lot of Matlab users, and I,m programming in Labview and Matlab.
When I create a testrig measurement I always have to convert data into Malab format, so I used the script server a lot... exept we have a limited pool of Matlab
licenses so my work was halted whenever the licences where gone.

So I wrote a Write2Matlab vi.

This vi can log data from a measurement and write it in a Matlab readable file format (Matlab6 R12).
After logging you can append more data. It works with(Double,Single,Int32,Int16,U16,U8,String) matrix see for yourself in an example (Write2matlab_test.vi).
Perhaps this is an alternative solution for your problem.

Please send me a reply if you find it usefull.
John
0 Kudos
Message 4 of 5
(3,419 Views)
We have posted a patch for this issue in the following knowledgebase document. Please post here if you have any further problems with this issue. Thank you.

KnowledgeBase 300A6NDT: How Can I Resolve MATLAB and Xmath Script Node Issues in LabVIEW?
0 Kudos
Message 5 of 5
(3,419 Views)