This example constructs 4 unequal bins and counts the frequencies.
Uses MtxExpr,Statistics; procedure Example; var Data, Bins, Freq: Vector; begin Data.SetIt(false,[1,2,3,4,5,6,7,8,9,10]); Bins.SetIt(false,[1.5, 2, 6, 9]); // define centerpoints, note that values are sorted! Histogram(Data,Bins, Freq); // Freq holds the count of elements in each bin end;
#include "MtxExpr.hpp" #include "Statistics.hpp" void __fastcall Example() { sVector data, bins, freq; data.SetIt(false,OPENARRAY(double,(1,2,3,4,5,6,7,8,9,10))); // Centerpoints, note that values are sorted! bins.SetIt(false,OPENARRAY(double,(1.5, 2.0, 6.0, 9.0))); Histogram(data,bins,freq); // Freq holds the count of elements in each bin }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|