Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 67048

Add to new values to an existing 1D array in a while loop

$
0
0

Hello,

I have a while loop that collects data from a DAQ Assistant and stores it into a 1D array. The number of loops is set by the user. I am trying to average the data from each iteration of the loop. So far I am only able to get the array to overwrite the previous array values with the new ones.

if Number of loops = 3

First Iteration                      Second Iteration                         Third Iteration                           New 1D Array        [Divide by Loop #

4.97                                      4.99                                               4.98                                            14.94                       for the average]
4.97                                      4.99                                               4.98                                            14.94
4.96                                      4.98                                               4.97                                            14.91
4.98                                      5.00                                               4.99                                            14.97
4.97                                      4.99                                               4.98                                            14.94

I would like to make this as general as possible as the loop number will vary depending on the user input. 

 


Viewing all articles
Browse latest Browse all 67048

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>