From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

store data in chart

Trying simple app to read 1000 pts, find the mean, graph samples and add the mean to a second graph. VB.NET code generated by the DAQmx wizard. It uses AnalogWaveform(Of Double) to hold the data. (Nice that the wizard generates code with an obsolete class!). How do I put the mean values into a second Waveform graph and make it look like a strip chart recorder? Code snippet that find mean values and stores them in an array is shown below.
 

Dim m_count As Int16 = 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim acquiredData() As NationalInstruments.AnalogWaveform(Of Double) = DaqTaskComponent1.Read

WaveformGraph1.PlotWaveforms(acquiredData)

Dim mean As Double = Statistics.Mean(acquiredData(0).GetScaledData())

Gauge1.Value = mean

Dim MeanArray(0) As Double

MeanArray(m_count) = mean

m_count = +1

ReDim MeanArray(m_count)

End Sub

The simple approach of MeanGraph.PlotWaveforms(MeanArray) fails with a long message.
 
0 Kudos
Message 1 of 2
(2,988 Views)
Problem solved by using PlotY(ydata).
0 Kudos
Message 2 of 2
(2,971 Views)