WOLFRAM SYSTEM MODELER

index

Returns the indices of the true elements of a Boolean vector

Wolfram Language

In[1]:=
SystemModel["Modelica.Math.BooleanVectors.index"]
Out[1]:=

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 elements in a Boolean vector b. The number of elements in the integer vector is the number of true elements in b.

Example

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

See also

allTrue, andTrue, 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 elements of b