Object arrays reference a collection of input or output objects
from an analysis step. You can access objects of the collection
with an index. The group of found model occurrences in the
ModelFinder step is an example of such a collection, as are
results from the
BlobAnalysis step, the
Measurement step, and the
PatternMatching step. Object arrays can prove useful to
process such information. For example, you can use object array
variables to compare the results of an analysis step against an
expected set of values, such as comparing the Area of the blobs found
against a set of valid areas.
Object array variables are read-only array variables that can
only reference the results of an analysis step. Any analysis step
that outputs an indexed collection of results can be referenced
with an object array variable.
For example, after running a
BlobAnalysis step, you can use an object array variable to
reference the data for each blob found (BlobAnalysis.BlobFound(index)). The properties
of that data can be accessed by expressions, such as:
-
SELECT(Blob_Results.BlobFound,
Item.Area), which uses the SELECT
array function to return the Area of each blob found in
Blob_Results,
which is an object array variable that references a
BlobAnalysis step's results.
-
Blob_Results.BlobFound(1).Area,
which returns the Area of only the first blob
in the Blob_Results object
array.
For information about accessing the results of a specific
analysis step, see that step's accessing results section, such as
the
Accessing BlobAnalysis step results section in
Chapter 3: BlobAnalysis step.
Some analysis steps can output an indexed collection whose
elements are themselves indexed collections. Sub-arrays refer to
these additional layers of collections. For example, in a
StringReader step, you can reference the collection of
strings read for a particular string model, using the expression:
StringReader.StringModels.StringModel.StringsRead.
Each string read also consists of an indexed collection of
characters. Since arrays in Matrox Design Assistant are
one-dimensional, to use an object array to reference the collection
of characters in a particular string, you would use the expression:
StringReader.StringModels.StringModel.StringsRead.Characters.
The FLATTEN
array function is useful when you have a collection of objects
inside an element of another collection, and you want to reference
the properties of both the parent collection and the child
collection within the same expression. The function uses the
SourceArray
parameter to reference the parent collection and the SubArray parameter to
reference the child collection. Using the SubIndex, SubItem, and SubItemCount keywords lets
you point to the properties of the child collection.
For more information, see the Array functions section later in this
chapter.