LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array problem

Hi,

I have written a VI which continuously reads an analog input. Then when I press acquire (a True/False Boolean), the values churned out by AI 1-scan are collated in an array (see the answer from Jared to the question that was posted called 'Help needed on building arrays' for an example of the sort of thing I'm talking about). Basically the VI has analog input data going into a case structure, inside which is a build array function. This is wired to a True/False Boolean so that when the button is pressed the array reads the values from the analog input. Leading from the case structure is an indicator, which displays the values that the array collected. I've also added a Mean.vi, which averages the values in the array. What I would
like to know is how can I get the array to start aquiring new data (to reset itself) each time the True/False Boolean is pressed so that the mean value reflects the mean of the values acquired since the button was last pressed (switched on and then off) and not the mean of all the values that have ever been read into the array (all the times the button has been switched on and off)? I thought about using a For Loop to collect X values and then stop? However, when I tried this I had difficulty with the wiring due to changes in the dimensions of the data. I would be very grateful for any help. If you need me to send you the VI so you can have a better look, please email me: ah2002@columbia.edu

Thanks,

Adrian
0 Kudos
Message 1 of 2
(2,624 Views)
Look at the vi attached. It performs these operations:

- Continuously acquire with AI 1 scan
- When a boolean is true accumulate readings in an array
- When the same boolean becomes false calculates and displays mean and reset the array for a new accumulation

You should consider to modify your actual vi by disassembling Acquire 1 scan in order to avoid the continuous confguration of the DAQ device: move AI Config outside the loop and AI Single Scan inside it.

This should solve you problem, if not replay to this message with some detail more or e-mail me.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 2
(2,624 Views)