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

TypeNameDefaultDescription
Boolean[:]bBoolean vector

Outputs

TypeNameDefaultDescription
IntegernNumber of true elements in b