Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Samplerate in Analogwaveform(of double)

Can anone help with the setting of the samplerate in Analogwaveform(of double)?

 

My multi-chanel time domain data is being read from a Sony SIR 1000 recorder data file.  I use the .log and .bin to scale the binary data and wish to store this in an Analogwaveform (of double) such that the samplerate is also included.  Typically this is 24000 Hz or 4.166666E-5 seconds.  I could also include the timestamp of the data as it's available in the .log file.  I assume that I will have to use the precision timing but cannot get this to work.

 

I wish to then store this data in a TDMS file so that I can obtain and plot any of the channels in my application.

 

any help woul be appreciated.

 

regards

 

Steve

0 Kudos
Message 1 of 2
(3,211 Views)

Hey Steve - 

 

Perhaps the easiest way to do this is to take your AnalogWaveform object and assign a new WaveformTiming object to its Timing property.  It could look something like the following:

 

double[] data = new double[] { 1.0d, 4.5d, 8.2d, 2.5d, 9.23d };
AnalogWaveform aw = AnalogWaveform.FromArray1D(data);
// Create a new timing object, specifying a 5 second sample rate
aw.Timing = WaveformTiming.CreateWithRegularInterval(new TimeSpan(0, 0, 5), DateTime.Now);

 

You could do the same with the PrecisionTiming property if you needed the extra precision.

 

NickB

National Instruments 

0 Kudos
Message 2 of 2
(3,209 Views)