You are here: Symbol Reference > Statistics Namespace > Functions > Statistics.Histogram Function
Stats Master VCL
ContentsIndex
Example

Equal bins -> faster algorithm.

Uses MtxExpr, Statistics, StatRandom;
procedure Example;
var Data, Bins, Freq: Vector;
begin
  Data.Size(1000);
  RandomNormal(-3,0.2,Data); // generate some normaly distributed data
  // Now, divide the data into 15 equal intervals
  Histogram(Data,15,Freq,Bins,true);
  // Bins holds the 15 intervals centerpoints
  // and Freq holds the count of elements in each bin
end;
#include "MtxExpr.hpp"
#include "Statistics.hpp"
#include "StatRandom.hpp"
void __fastcall Example()
{
  sVector Data, Bins, Freq;
  Data.Size(1000,false);
  RandomNormal(-3,0.2,Data); // generate some normaly distributed data
  // Now, divide the data into 15 equal intervals
  Histogram(Data,15,Freq,Bins,true);
  // Bins holds the 15 intervals centerpoints
  // and Freq holds the count of elements in each bin
}
Copyright (c) 1999-2025 by Dew Research. All rights reserved.