Period: IStatPeriod;
The Period property determines sample period parameters.
Sub Main;
Var
Gaps: ISmFillGapsProcedure;
s1, s2, m: Array[15] Of Double;
Series: ISlSeries;
S: ISlSerie;
res, i, j: Integer;
d0,d1: Double;
Begin
s1[00] := 2; s2[00] := 4110;
s1[01] := 5; s2[01] := 4280;
s1[02] := 6; s2[02] := Double.Nan;
s1[03] := Double.Nan; s2[03] := 4545;
s1[04] := Double.Nan; s2[04] := 4664;
s1[05] := 9; s2[05] := 4861;
s1[06] := 10; s2[06] := 5195;
s1[07] := 1; s2[07] := 5389;
s1[08] := 2; s2[08] := Double.Nan;
s1[09] := 2; s2[09] := Double.Nan;
s1[10] := 2; s2[10] := 5948;
s1[11] := 2; s2[11] := 6218;
s1[12] := 2; s2[12] := 6521;
s1[13] := Double.Nan; s2[13] := 6788;
s1[14] := 2; s2[14] := 7222;
Gaps := New SmFillGapsProcedure.Create;
Gaps.Period.FirstPoint := 1;
Gaps.Period.LastPoint := 15;
Series := Gaps.InputSeries;
Series.Add.Value := s1;
Series.Add.Value := s2;
Gaps.MissingData.Method := MissingDataMethod.Geometric;
res := Gaps.Execute;
If res <> 0 Then
Debug.WriteLine(Gaps.Errors);
Else
For i := 0 To Series.Count -1 Do
S := Series.Item(i);
Debug.WriteLine("Series N " + i.ToString + " Result series " + "Original values of the series");
For j := 0 To m.Length - 1 Do
d0 := S.Value[j];
d1 := S.OriginalValue[j];
Debug.WriteLine(j.ToString + ", " + d0.ToString + ", " + d1.ToString);
End For;
End For;
End If;
End Sub Main;
After executing the example the console window displays result and original series:
Module execution started
Series N 0 Result series Original values of the series
0, 2, 2
1, 5, 5
2, 6, 6
3, 6.8682854553199917, 1.#QNAN
4, 7.8622241826266892, 1.#QNAN
5, 9, 9
6, 10, 10
7, 1, 1
8, 2, 2
9, 2, 2
10, 2, 2
11, 2, 2
12, 2, 2
13, 2, 1.#QNAN
14, 2, 2
Series N 1 Result series Original values of the series
0, 4110, 4110
1, 4280, 4280
2, 4410.5101745716447, 1.#QNAN
3, 4545, 4545
4, 4664, 4664
5, 4861, 4861
6, 5195, 5195
7, 5389, 5389
8, 5569.2379734256947, 1.#QNAN
9, 5755.5041018086358, 1.#QNAN
10, 5948, 5948
11, 6218, 6218
12, 6521, 6521
13, 6788, 6788
14, 7222, 7222
Module execution finished
See also: