Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract timestamp information from AnalogWaveform?

The following is my programme code:

 

using NationalInstruments; using NationalInstruments.UI; using NationalInstruments.UI.WindowsForms; using System; using System.Windows.Forms; namespace DaqApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button_Click(object sender, EventArgs e) { try { NationalInstruments.AnalogWaveform<double>[] acquiredData = daqTaskComponent.Read(); waveformGraph.PlotWaveforms(acquiredData); DateTime Timestamp = acquiredData.GetTimeStamps(0, 10); } catch (NationalInstruments.DAQmx.DaqException ex) { MessageBox.Show(ex.Message, "DAQ Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private DateTime GetTimeStamps(AnalogWaveform<double>[] acquiredData) { throw new Exception("The method or operation is not implemented."); } private void daqTaskComponent_Error(object sender, NationalInstruments.DAQmx.ComponentModel.ErrorEventArgs e) { // TODO: Handle DAQ errors. string message = e.Exception.Message; MessageBox.Show(message, "DAQ Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); daqTaskComponent.StopTask(); } } }

I want to extract the timestamp information from acquiredData, but it does not work.

Who can help me? I am freshman~

Thanks a lot~

0 Kudos
Message 1 of 3
(4,242 Views)

In your code, there is :

 

 DateTime Timestamp = acquiredData.GetTimeStamps(0, 10);

 

Actually, the GetTimeStamps function in the WaveformTiming Class in Measurement Studio that can extract this information from a waveform.

 

What does GetTimeStamps function return when you run your code?

 

By the way, you can see this link Time sample from Daq read as a reference.

Regards
Message 2 of 3
(4,219 Views)

The code can not be compiled, it is indicated that GetTimeStamps has not been defined.

NationalInstruments.Common has already been quoted in my program.

Would you like give me an example how to use GetTimeStamps function?

Thanks.

Message 3 of 3
(4,216 Views)