countTrue

Returns the number of true elements in a Boolean vector

Information

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

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.

Syntax

n = countTrue(b)

Inputs (1)

b

Type: Boolean[:]

Description: Boolean vector

Outputs (1)

n

Type: Integer

Description: Number of true elements in b