Finds the closest lower and higher value in the driving column, calculates the output column's value using linear interpolation and returns the result. If the output column name is omitted, then the value of the key column is calculated. If an exact match of the value is found, then no interpolation is done. If the value is outside the range of the driving column's values, then an extrapolation is done.
double InterpolateDicByCol(string dictionaryName; string drivingColumnName; double value; [string outputColumnName])
dictionaryName |
The name of the dictionary to interpolate in. |
drivingColumnName |
The name of the column whose values shall drive the interpolation. |
value |
The value to find the closest lower and higher key value for. |
outputColumnName |
Optional name of the column to calculate the value for using interpolation. If omitted the key column is calculated. |
Example
InterpolateDicByCol("MovementAtTime", "Distance", 30; "Acceleration")
Returns the interpolated value of the column "Acceleration" in the dictionary "MovementAtTime" at the interpolation value 30 of the column "Distance".
Remarks
This method requires that the keys and referred columns of the dictionary are numerical or can be converted to double using "NumberFormatInfo.InvariantInfo".