functionindex
Returns the indices of the true elements of a Boolean vector
Extends from Modelica.Icons.Function (Icon for functions).
Information
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.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean[:] | b | Boolean vector |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer[countTrue(b)] | indices | Indices of the true elements of b |