TIAFreq

From SCAR Divi Manual
Jump to: navigation, search

Definition

procedure TIAFreq(const TIA: TIntArray; out Values, Frequencies: TIntArray);

Availability

SCAR Divi 3.38 > Current

Description

Determines the absolute frequency of all integer values in the given array TIA. The unique values are returned in Values and their corresponding frequencies in Frequencies.

Example

var
  TIA, Values, Frequencies: TIntArray;
  Idx, Len: Integer;

begin
  TIA := [2, 0, 8, 1, 2, 6, 1, 4, 3, 3, 4, 2, 4, 4];
  TIAFreq(TIA, Values, Frequencies);
  Len := Length(Values);
  for Idx := 0 to Len - 1 do
    WriteLn('Value: ' + IntToStr(Values[Idx]) + 
      ' - Count: ' + IntToStr(Frequencies[Idx]));
end.

Output:

Value: 2 - Count: 3
Value: 0 - Count: 1
Value: 8 - Count: 1
Value: 1 - Count: 2
Value: 6 - Count: 1
Value: 4 - Count: 4
Value: 3 - Count: 2

See Also