CSV data are read using ILMath.csvread<T>()
. The function allows the specification of the overall element type via the generic parameter:
string s =
@"2014-03-15 18:00:00, 19700000.0, -30.19
2014-03-15 18:00:00, 19700781.25, -31.19
2014-03-15 18:00:00, 19701562.5, -30.43
2014-03-15 18:00:00, 19702343.75, -30.37
2014-03-15 18:00:00, 19703125.0, -27.06";
ILArray<double> A = ILMath.csvread<double>(s);
>A
<Double> [5,3]
(:,:) 1e+007 *
0,00000 1,97000 0,00000
0,00000 1,97008 0,00000
0,00000 1,97016 0,00000
0,00000 1,97023 0,00000
0,00000 1,97031 0,00000
There is currently no individual column format specification. So, in order to include the dates as such (DateTime), you must create your own datatype – as you pointed out.
This, however, introduces other problems:
1) csvread() expects homogeneous elements from the csv file. While ILArray<datasample>
is fine (and useful), csvread does not support that directly.
2) If your goal is to plot the data, you will have to convert the datetime to some real number anyway. The Drawing namespace expects ILArray only.
3) Furthermore, most ILMath functions are specialized for ILArray of some real (System.Value) element format. Having an ILArray would bring very limited support by means of those functions.
EDIT: How about this? :)
private void ilPanel1_Load(object sender, EventArgs e) {
ILArray<float> A = ILMath.tosingle(ILMath.rand(4, 3000));
ilPanel1.Scene.Add(
new ILPlotCube(twoDMode:false) {
new ILPoints() {
Positions = A["0,1,2;:"],
Colors = new ILColormap(Colormaps.Jet).Map(A["2;:"]).T,
Color = null
}
});
}