Description

Interpolates values to create a longer or shorter array.

Return Type

A McObject object.  

A McObject of type mcobjTypeREAL holding an array or matrix shaped like the source data, except that the slowest moving dimension (dimension zero) is made to be the specified NewDim0Size size that may be either smaller or larger than the original dimension size.

Syntax

object.McInterpolateValues (ArrayToInterpolate, NewDim0Size, [bInterpolateCounts])

The McInterpolateValues Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McOMGlobal.
ArrayToInterpolateRequired. A Variant value.

A Variant or McObject holding a one or higher dimensioned array of values for which values are to be interpolated to resize the slowest moving dimension. All dimensions must be one one size. The type if this array may be any type castable to Double (mcobjTypeREAL), but the result array is always of type Double.

NewDim0SizeRequired. A Long value.

Size of the leftmost dimension of the interpolated results array or matrix.

bInterpolateCountsOptional. A Boolean value.

If True, interpolate the arrays as if they were counts, not analog values. If False or missing, interpolate array non-count values. When interpolating as counts, all values are assumed to be positive and the sum of the input and output array values are made to be equal by scaling the output values.

Remarks

This method resizes the slowest moving dimension (leftmost in C/C++, rightmost in VB) of an array or matrix by interpolating all elements along that dimension to create a longer or shorter array.

For multidimensional arrays, the interpolation is done column wise, so that an array of X,Y pairs (e.g, Dim Pts(2,nPts) As Single) the X's are interplated with their neighboring X and the Y's with neighboring Y's. All “rows” of a multidimensional object must have the same length (i.e., if an array of Variant is passed in, each Variant in the array must have the same shape).

Expansion and contraction are different operations. If the interplation lengthens the array (expansion), adjacent input values are interpolated for each output value. That is, the first and last source values are mapped onto the first and last results values, and all intermediate values are linearly interpolated.

If the array is shortened (contraction), both interpolation and averaging are used. Each result value is made up of an average of an integral number of interpolated input values.

If the bInterpolateCounts argument is True, then the values in the array are assumed to be counts rather than analog values. In this, case the total sum of the output values are scaled to be equal to the total sum of the input values.

Note that the results of both expansion or contraction interpolations, whether treated as counts or not, will usually be non-integral values, even if the source array consists of only integers. Furthermore, a “round-trip” expansion-then-contraction will never yield the original source array. (E.g. the length-2 array 1,4 made length 4 becomes 1,2,3,4 which becomes 1.5,3.5 when contracted back to length-2).

Should you wish to resize some dimension other than the slowest moving one, use the McTranspose method to rearrange dimensions (see Samples).