functioncountTrue
Returns the number of true elements in a Boolean vector
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
countTrue(b);
Description
This function returns the number of true elements in a Boolean vector b.
Example
countTrue({false, true, false, true}) returns 2.
See also
allTrue, andTrue, anyTrue, enumerate, firstTrueIndex, index, and oneTrue.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean[:] | b | Boolean vector |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | Number of true elements in b |