enumerate

Enumerates the true entries in a Boolean vector (0 for false entries)

Information

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

Syntax

enumerate(b);

Description

This function returns an integer vector that consecutively numbers the true entries in a Boolean vector b. The false entries are indicated by 0.

Example

enumerate({false, true, false, true}) returns {0,1,0,2}.

See also

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

Syntax

enumerated = enumerate(b)

Inputs (1)

b

Type: Boolean[:]

Description: Boolean vector

Outputs (1)

enumerated

Type: Integer[size(b, 1)]

Description: Indices of the true entries (increasing order; 0 for false entries)