The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



CountTrueCellsOfArray


Unit:SDL_openarrays
Class: none
Declaration: [1] function CountTrueCellsOfArray (Arr: TBoolArray): integer;
[2] function CountTrueCellsOfArray (Arr: TBool2DArray): integer;
[3] function CountTrueCellsOfArray (Arr: TBool2DArray; FirstCol, LastCol, FirstRow, LastRow: integer): integer;

The funcion CountTrueCellsOfArray counts the number TRUE cells in the boolean array Arr. Version [3] lets you restrict the range where the TRUE cells should be counted. The parameters FirstCol, LastCol, FirstRow and LastRow specify the first and last column and row, respectively.

The function returns the following error codes:

>0 ... everything is OK, the returned number of the number of TRUE cells
-1 ... Arr has zero size
-2 ... one or several of the range parameters is invalid (either < 0 or greater than the number of columns or rows)

Hint: Setting both the low and high parameter of a dimension (i.e. FirstCol and LastCol) to zero values forces the function to use all elements of that dimension.



Last Update: 2023-Feb-06