2.1.24.4.15 ocmath_count


Description

Count the number of occurances of the elements in the input vector that are satisfied with the comparison condition.

Syntax

int ocmath_count( double dValue, uint nPts, const double * pIn, int nCondition = COUNT_EQUAL )

Parameters

dValue
[input] the double value for comparison.
nPts
[input] the size of input array.
pIn
[input] input array.
nCondition
[input] comparison condition.
COUNT_GREATER_EQUAL,//greater than or equal(>=)
COUNT_GREATER,//greater than(>)
COUNT_LESS_EQUAL,//less than or equal(<=)
COUNT_LESS,//less than(<)
COUNT_EQUAL,//equal(==)
COUNT_UNEQUAL //unequal(!=)

Return

The function returns the number of values found in the given array.

Examples

EX1

void ocmath_count_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    wks.SetSize(-1,2);
    DataRange dr;
    dr.Add("X", wks, 0, 0, -1, 0);
    dr.Add("X", wks, 0, 1, -1, 1);
    vector vIn;
    dr.GetData(&vIn, 1);
    double dbMin, dbMax;
    vIn.GetMinMax(dbMin, dbMax);
    double dValue = (dbMin+dbMax)/2;
    int num=ocmath_count(dValue, vIn.GetSize(),vIn, COUNT_LESS);
}

Remark

See Also

Header to Include

origin.h

Reference