Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Conditional Processing » ClassifyByPredicate

ClassifyByPredicate


Separates the elements of the input array into two output arrays. The first output array contains all the elements for which the associated predicate is True.

Name Type Description
inArray <T>Array Elements to be classified
inPredicate BoolArray Corresponding logical values determining the output array for each of the elements
outAccepted <T>Array Array of elements corresponding to 'true' values
outRejected <T>Array Array of elements corresponding to 'false' values

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

Applications

E.g. creating separate arrays of OK and NOK objects.

Hints

  • Before using this filter you need to have an array of objects (to be classified) and an array of boolean values that describe which elements of the first array fulfill some condition.
  • Connect the array of objects to the inArray input and connect the array of boolean values to the inPredicate input.

Examples

inArray = {"Alice", "Bill", "Frank", "Patricia", "Thomas"}
inPredicate = {True,True,False,False,True}
outAccepted = {"Alice", "Bill", "Thomas"}
outRejected = {"Frank", "Patricia""}

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 Inconsistent array lengths on input in ClassifyByPredicate.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of Classify filter group.

See Also

  • ClassifyByCase – Separates the elements of the input array into several output arrays, depending on the associated array of case indices.
  • ClassifyByRange – Separates the elements of the input array into three output arrays, depending on whether the related values fall below, into or above the specified range.