ocmath_us_find_most

 

Description

Find the most bin. This is an OriginPro only function.

Syntax

USHORT ocmath_us_find_most( USHORT * pData, uint nSize, uint nBins, double * pRatio = NULL )

Parameters

pData
[input] buffer containing data
nSize
[input] size of pData
nBins
[input] the numher of bins
pRatio
[output] the ratio

Return

the most bin's area

Examples

EX1

void ocmath_d_find_most_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    wks.SetSize(-1,3);
    DataRange dr;
    dr.Add("Y", wks, 0, 1, -1, 1);
    vector vecData;
    dr.GetData(&vecData, 0);
    uint nSize = vecData.GetSize();
    uint nBins = nSize/2;
    double pRatio;
    double dmost=ocmath_d_find_most(vecData,nSize,nBins, &pRatio);
}

Remark

Find the most bin, which includes most datas of pData, by dividing pData into nbins.

Then, calculate pRatio, pRatio = uMax / dTotal where uMax is the most bin's frequence,

dTotal is the sum of all bins' frequence.

Data types supported:

double: ocmath_d_find_most
unsigned short: ocmath_us_find_most

See Also

ocmath_d_frequency_count

header to Include

origin.h

Reference