index

Returns the indices of the true entries of a Boolean vector

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

index(b);

Description

This function returns an integer vector that contains indices to the true entries in a Boolean vector b. The number of entries in the integer vector is the number of true entries in b.

Example

index({false, true, false, true}) returns {2,4}.

See also

allTrue, anyTrue, countTrue, enumerate, firstTrueIndex, and oneTrue.

Syntax

indices = index(b)

Inputs (1)

b

Type: Boolean[:]

Description: Boolean vector

Outputs (1)

indices

Type: Integer[countTrue(b)]

Description: Indices of the true entries