LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting error when passing variable to Matlab script

Hi

 

I am using LabVIEW 2013 Version 13.0f2 (32bit) and MATLAB R2014b (Version: 8.4.0.150421) in Windows 7 Professional  Version 6.1 (Build 7601: Service Pack 1).

 

I am trying to pass measured data to a matlab script to plot but I get errors.

I have made a small program to make the problem easyer to solve and I get this error

 

Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Reference to a cleared variable A.
. in MatlabTest.vi

 

I tried the solution mentioned in http://digital.ni.com/public.nsf/allkb/4475BC3CEB062C9586256D750058F14B though it was intended for an older version. This gave me this error instead

 

Error 1048 occurred at LabVIEW:  LabVIEW failed to get variable from the script server. Server:"??? Undefined function or variable 'num'.
" in MatlabTest.vi

 

The problem occures when I try to access the input, in other words I can have inputs to my script as long as I do not use them.

 

How can I solve this?

0 Kudos
Message 1 of 4
(5,024 Views)

Hi,

 

Matlab clear all command deletes all your variables,

try commentting clear all command (%clear all), or remove it and should work better.

 

Regards

Message 2 of 4
(4,984 Views)

Thank you so very much.

 

I shold of cours have realised that that was what happened but I always use the three clearing lines (close all, clear all, clc) in the beginning of a script to make sure that no old and irrelevant data corrupts my script and did not think about when the inputs were generated.

 

Again, Thank you!

0 Kudos
Message 3 of 4
(4,957 Views)

Hello, I also encountered the same mistake, how should I solve?

0 Kudos
Message 4 of 4
(4,232 Views)