Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Array Basics » GetArrayElement

GetArrayElement


Extracts a single element from an array at the specified index.

Name Type Range Description
inArray <T>Array Input array
inIndex Integer 0 - Index within the array
inInverse Bool Reversed order in the array
outValue <T> Element from the array

The type of this filter is defined using the type variable T which represents any valid type. Read more.

Hints

  • Make sure that inIndex will always be in range. If this cannot be guaranteed, use GetArrayElement_OrNil instead.
  • To get the last element of a non-empty array use inIndex = 0 and inInverse = True.

Examples

Description of usage of this filter can be found in examples and tutorial: Mounts (Contour Analysis), Mounts (Segmentation), User Filter Example - Database.
inArray = {1,4,3,2,5}
inIndex = 3
inInverse = False
outValue = 2

inArray = {1,4,3,2,5}
inIndex = 3
inInverse = True
outValue = 4

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Index out of range in GetArrayElement.
DomainError Negative index in GetArrayElement.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of GetArrayElement filter group.

See Also