LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to get variable from script server - Java problem?

I'm using MATLAB script nodes in order to access the Java API of Micro-Manager (and if you know offhand of a less convoluted way to do this, I'd like to hear it).  Specifically, I need to get a 512x512 array of Real into LabVIEW.  My scripts are running okay; I can even use imagesc in my script and MATLAB will plot the data in the array without any problem.  However, if I create a correspoding output terminal on the script node and try to wire it up, I inevitably get

Error 1048 occurred at LabVIEW: LabVIEW failed to get variable from the script server. Server: 7.4.0.287 (R2007a)" in [etc].

I tried wiring up a pre-initialized 512x512 array to an input terminal on the script node, but that doesn't seem to help.  Neither does adding a two-second pause to the end of the script, or assigning the variable to a different name and then using the different name in the output terminal.  It doesn't seem like the array size is a problem, since a script containing the line "foo = ones(512,512)" will execute without any problem and return stuff through an output terminal named "foo".

I'm running LabVIEW 8.5, and the "MATLAB Script Node - Fractal" example runs without any problems.  What else can I do to diagnose this difficulty?
0 Kudos
Message 1 of 3
(3,523 Views)
Ahh, how silly of me!  The function in question was returning an array of int16, so I just needed the line foo = double(bar).  (I figured that out when I realized MATLAB wasn't letting me save the array as an ASCII file either.)

It seems I presumed MATLAB or LabVIEW would just recast the array as doubles somewhere along the way.  Oh well, I hope this information is useful to someone sometime.

(And if you've had further adventures with Micro-Manager, do please bring them up.)
0 Kudos
Message 2 of 3
(3,517 Views)

One more thing...this keeps biting me when I'm not paying attention...

 

Make sure the data sent out from Matlab is NOT stored as a sparse matrix. If it is, just use the matlb "full()" function to expand it out.

0 Kudos
Message 3 of 3
(3,258 Views)