Description

Selected values from a Variant are returned.

Return Type

A McObject object.  

A McObject instance holding the selected elements of the Operand argument. The returned result will be of the type of Operand. It's shape will depend on which elements in which dimensions are selected.

Syntax

object.McOpSelect (Operand, [varSelector0], [varSelector1], [varSelector2], [varSelector3])

The McOpSelect Method syntax has these parts:

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

Operand. May be a scalar or array of any numeric or string type.

varSelector0Optional. A Variant value.

Optional selector for dimension 0 of vector data. Dim0 is the slowest moving dimension. If other selector arguments are missing and the number of dimensions in the selectors shape matches the number of dimensions in the Shape property, then selector values are treated as indices into the values unrolled into a 1-dimensional array.

varSelector1Optional. A Variant value.

Optional selector for dimension 1 of vector data.

varSelector2Optional. A Variant value.

Optional selector for dimension 2 of vector data.

varSelector3Optional. A Variant value.

Optional selector for dimension 3 of vector data.

Remarks

Up to 4 dimensions of optional index selectors may be supplied for vector data. If selectors are supplied, then the selected sub-array is returned as the value. The dimension selector may be a single, scalar index value or it may be an array of such values; negative indices in a selector are legal, but they are ignored. If the selector for a dimension is missing (VT_EMPTY, VT_ERROR or VT_NULL) then all elements of that dimension will be selected.

For N-dimensional shaped McObject's, it is possible to supply selector values as indexes into the shape unwrapped into 1-dimensional array. This is done by supplying only the varSelector0 argument (leaving the other arguments missing) and supplying it as a N-dimensional array (if varSelector0 is supplied as a scalar or 1-D array, then it selects only from Dimension 0). The result of selecting in this way is a 1-dimensional array of the selected elements. This situation is actually a very common one, since the logical vector operators (e.g., McOMGlobal.McOpEq) preserve the shape of the left argument. The samples illustrate this and other selection rules: they are well worth examining if you are selecting from anything but 1-dimensional arrays.

The selector arguments are supplied in C/C++ order for multidimensional shaped objects. That is, the left-most argument selects into Dim0, the slowest moving dimension. This is the same ordering as in C/C++, but it is the reverse of dimension ordering in VB.

The returned subvector can differ subtly in its shape depending on whether a length-1 dimension selector is supplied as a length-1 array or as a scalar index value. If supplied as a scalar value, then the selected dimension is removed from the returned shape (the dimensionality drops by one), if supplied as an array, the dimension is kept and the returned value is always an array.

A missing (e.g., VT_ERROR) selector on a variable inner dimension of a multidimensional object will always preserve the dimension and will always expose it as an array of VARIANT's if the mcobjUserFlagAlwaysVector UserFlags bit is set; if the mcobjUserFlagAlwaysVector UserFlags bit is clear then the dimension will be exposed as an array of VARIANT's only if the sizes of the elements of the dimension actually vary.