LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ outputs not updating with MATLAB script

Hello,

I have a Matlab script that adjusts the range and offset voltage of my
DAQ board for optimal signal capture... Sometimes it works, and
sometimes it doesn't. Most recently, it doesn't, and nothing has been
changed in the matlab code or the vi. Since this isn't an easily
repeatable error, it is proving difficult to debug. It seems that the
vi just stops listening to Matlab, and restarting Labview or the
computer doesn't help.

I have a uesr input box where the user can put in an initial guess at
the range and offset. These are branched to inputs into the Matlab
script, which should then take over and adjust the values according to
its rules. It has done this successfully on many occasions. The
output from the Matlab script is linked as an input to a local
variable.

Also since the last time it worked, sometimes it does change the range
value, but of channel ao1 rather than ao0 as it is supposed to.

All the hardware seems to be fine, as in a separate vi (without hte
matlab script) all values can be changed manually -- it's just when the
matlab script is incorporated that things go wacky.

If anyone can help me figure this out, I'd greatly appreciate it.
Thank you for your time.

0 Kudos
Message 1 of 2
(2,491 Views)
These problems that only happen from time to time can be the hardest to track down and debug. My first guess is that you have a race condition. This means that you aren't correctly controlling the order of execution in your LabVIEW VI. You could be, for instance, writing the value into the Matlab Script Node before you have updated it with a valid value.

This sounds like the case, because errors like these will work sometimes, and fail other times if the timing is not just right. Double check that you're controlling the order of execution in your program, especially if using local variables.
Jarrod S.
National Instruments
0 Kudos
Message 2 of 2
(2,482 Views)