Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS, AppendData()

I'm using the NationalInstruments.Tdms.dll, v4.0.30319 for logging my aquisited data in my WinForm App.

 

It worked fine when the data was in the AnalogueWaveForm-format, but I also need to be able to log data from an double array.

 

 

But the following example doesn't work:

 


channelGroup.AppendData<double[ ]>(channels, waveforms, NationalInstruments.Tdms.TdmsDataLayout.Interleaved);

 

channels = new TdmsChannel[ Channels(16) ];

waveforms = double[ Channels(16) ] [ SAMPLE_COUNT ]

NIex.png

 

 

Running this code throws the following Exception:

System.InvalidOperationException: The type parameter of the method does not match the data type of the TDMS channel data.

at NationalInstruments.Tdms.TdmsChannelGroup.AppendData[TData](TdmsChannel[] channels, TData[] data, TdmsDataLayout dataLayout, TdmsSaveFile saveFile)
at NationalInstruments.Tdms.TdmsChannelGroup.AppendData[TData](TdmsChannel[] channels, TData[] data, TdmsDataLayout dataLayout)
at Datenaufnahmesystem.FormMain.WriteTdmsWaveforms(Double[][] waveforms) in \FormMain.cs:line 468
A first chance exception of type 'System.InvalidOperationException' occurred in NationalInstruments.Tdms.dll

 

 

 

How can I make this work?

0 Kudos
Message 1 of 2
(5,254 Views)

I wasnt able to append all channels at once like described above, but doing it for each channel seperatly works just fine:

 

channels[0].AppendData(waveforms[0]);
channels[1].AppendData(waveforms[1]);

..

..

 

0 Kudos
Message 2 of 2
(5,216 Views)