07-08-2011 04:59 PM
Hi,
I want to create a waveformgraph and i use the part of the code below:
private AnalogWaveform<double> CreateWaveformFromData(DateTime[] timeStamps, double[] data) { try { AnalogWaveform<double> wave; wave = AnalogWaveform<double>.FromArray1D(data); wave.Timing = WaveformTiming.CreateWithIrregularInterval(timeStamps); return wave; } catch (Exception ex) { ex = ex; return null; } }
The compilation passed, but when i run the code to "wave = AnalogWaveform<double>.FromArray1D(data);"
I got a exception: [System.TypeInitializationException] = {"The type initializer for 'NationalInstruments.PrecisionWaveformTiming' threw an exception."}
Here, i don't think i define the waveform timing here, why do i receive this type initialization error?
Thanks a lot!
Kevin
07-11-2011 04:43 PM
Kevin,
Is this error occurring on the development computer or the deployment machine? Which version(s) of MS and VS are you using, and on which OS?
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
07-12-2011 01:31 PM
It's in development computer. WinOS: Win7, MS: visual studio 2010, VS: visual studio 8.0.1
Thanks!
Kevin
07-13-2011 06:56 PM
Kevin,
Is this happening every time you try to create a waveform or only when in a specific program?
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
07-13-2011 08:22 PM
Yes, it happen every time.
Actually we don't need make things complicated. I just want to draw a simple graph by x array and y array. The x values should be DateTime values.
I use this kind of control long time ago. we use ActiveX control that time. I remember the method something like plotXY(x array, y array) is ok. But the rule looks like changed for the new version MeasurementStudio. If you have similiar example code i can borrow, that will be good. 🙂
Thanks!
Kevin