Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert the double[] result from a WaveformGraph.GetXData() method?

I am using a WaveformGraph as a scope chart where I have the xAxis major division format as a DateTime "hh:mm:ss".
 
I want to be able to extract the data and save it to a delimeted text file.
 
To do this I am using the WaveformGraph.GetXData() and WaveformGraph.GetYData() methods, both of which return a double[].
 
I am unsure how to convert this result back to a DateTime type as I can not implicity convert a double to a DateTime, and the DateTime constructor does not allow a double.
0 Kudos
Message 1 of 3
(3,390 Views)
Hey adamhb,

One way to do this would be to use the DataConverter class from Measurement Studio.  It will allow you to convert an array of doubles to an array of DateTime objects.  I have included a small snippet of code below that shows how to use it.  Also it is used in the example PlotDateTime which should be located in your Measurement Studio directory under DotNET\Examples\UI\Graph\PlotDateTime.

DateTime[] mydate = (DateTime [])DataConverter.Convert(DoubleDataArray,typeof(DateTime[]));
Pat P.
Software Engineer
National Instruments
Message 2 of 3
(3,377 Views)
Thanks, works perfectly
0 Kudos
Message 3 of 3
(3,372 Views)