functioncard

Returns the number of elements of a Boolean vector that are true

Extends from Modelica.Icons.Function (Icon for functions).

Information

Syntax

card(b);

Description

The function returns the number of true-elements of Boolean vector b.

Example

The property is demonstrated with the following example calling the function as:

nTrueElements = card( b )
simulation result

Inputs

TypeNameDefaultDescription
Boolean[:]bBoolean vector

Outputs

TypeNameDefaultDescription
IntegerresultNumber of true entries