LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create an array of voltage values?

I would like to measure voltage continuously, and collect that data in a small array, e.g. 10 elements (consecutively collected voltage values) and then do some calculations on the array values.  Then, I want to throw away those array values and collect the next 10 voltage values in a new array and repeat the calculation etc.

 

However, I am not understanding how to get the array formed.  I think an array should be created by a FOR LOOP, but, is the BUILD ARRAY the correct function to capture the values?  Does the BUILD ARRAY know to accept the values consecutively by the wiring I show in the attached vi??

 

Will the attached vi collect 10 values, allow a calculation, discard those 10 values, and then repeat?

0 Kudos
Message 1 of 4
(2,420 Views)

Hi dav,

 

I suspect you're using DAQmx to "measure" those voltage values.

Why don't you read in 10 samples at a time (DAQmxRead configured to give 10 samples per read), then do your calculation, the do the next read?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,411 Views)

Don't create your DAQmx task in every iteration of the While Loop, you will eventually run out of resources.

 

As Gerd said, read 10 samples at once rather than 1 sample 10 times.  Then you can get rid of the inner For loop.  You'd use DAQmx Read 1 channel N samples.

 

0 Kudos
Message 3 of 4
(2,407 Views)

Yes, I am using DAQmx to read the voltages.  Thanks for the suggestion.  I will try to make it work.

Dave

0 Kudos
Message 4 of 4
(2,403 Views)