Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

averaging data for NI 4472.

I am acquiring data on an NI 4472 DSP board using Visual Basic 6.0 and Measurement Studio 6, and I would to average the data (similar to what Labview has). What is a good ways to do this, I would to a 4 time s averaging. the file below is for 1 DSP board, acquiring 8 channels. IAgain, I would like to average the data after acquiring them. Please help.
0 Kudos
Message 1 of 2
(6,152 Views)
Hello Mike M,

From your question, I'm not entirely sure what type of averaging you are looking to do. For instance, the following VB6 code uses the Measurement Studio CWArray control to average the input array in chunks of 4:

Dim mydatasize As Integer
Dim mydata As Variant
Dim avg As Integer
Dim mynewdata As Variant
Dim i As Integer
Dim phase As Variant

mydatasize = 4000
avg = 4

mydata = CWDSP1.SineWave(mydatasize, 1, 10, phase)

ReDim mynewdata(0 To (mydatasize / avg) - 1)

For i = LBound(mynewdata) To UBound(mynewdata)
mynewdata(i) = CWArray1.SumArray(CWArray1.Subset1D(mydata, i * avg, 4)) / CDbl(avg)
Next

Hope this gets you started!

David Mc.
NI Applications Engineer
0 Kudos
Message 2 of 2
(6,152 Views)