LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

need to store variables/data

Hi folks.
 
I am almost new to the Labview and using math script with it for data processing. I am using Labview 8.2 and DAQmx6024E, and I am acquiring a non priodic unknown voltage.
 
The issue: I have placed the math script inside the while loop after DAQassistant. The data is so converted to scalar and given to the input node of the mathscript and processed data is stored in there . But at the next sampling loop, every variable inside the math script is erased and I dont have any record from the previous sampling assignment:(. If I increase the number of the scan, I don't have real-time event observation on the front panel as long as it is updated after finishing scaning. How can I store my vital data and reuse it at the begining of next loop??
 
Your comments are highly appreciated.
0 Kudos
Message 1 of 6
(8,149 Views)
 
To retain data between interations of a loop, you would typically use a shift register. Thus the data from the previous iteration can be fed to the mathscript node via an input terminal.
 
What kind of processing do you do inside the mathscript node. It might be easier to use plain LabVIEW for everything.
0 Kudos
Message 2 of 6
(8,144 Views)
Thaks for the reply.
 
Actualy DAQassistant and math script are inside one loop and only loop I used in my program. Let say I just want to save just an output of math script for next loop interations. How can I feedback this output to the same mathscript through the shift register?
Thanks.
0 Kudos
Message 3 of 6
(8,135 Views)

I guess I don't quite understand where you have difficulties.

The shift register would go on the edges of the loop. Now connect the output conector of the script node to the right shift register and a corrsponding input connector to the left shift register. You also might want to initialize the shift register.

0 Kudos
Message 4 of 6
(8,130 Views)
Just to add to altenbach's post, you'll probably want to setup something that looks similar to this:



This is of course a very simple example (I'm sure your .m code is much more complex) and you'll notice I used the Simulate Signal VI rather than the DAQ Assistant as I don't have any DAQ hardware on my laptop.

The shift register can hold an array of values rather than the single scalar this example uses -- you just need to make sure you initialize it on the left of the loop with the correct data type.

Regards,

Simon H
Applications Engineer
National Instruments
http://www.ni.com/support/

Message Edited by Simon H on 10-15-2007 10:22 AM

0 Kudos
Message 5 of 6
(8,122 Views)
Thank you guys. my problem is fixed!!
0 Kudos
Message 6 of 6
(8,099 Views)