RoundBinningRange

 

Description

Similar to LabTalk limit -r command, to round a set of min, max and increment values

Syntax

BOOL RoundBinningRange( double * pmin, double * pmax, int nSteps, int nSpace, double * pinc, DWORD dwCntrl = 0 )

Parameters

pmin
[modify] pointer to the min value
pmax
[modify] pointer to the max value
nSteps
[Input] Should be set to the number of points. This is not the number of bins. You can calculate the number of bins after the function returns using the min, max, and inc values.numBins = (max - min) / inc
nSpace
[Input]axis scale type. Can be one of the following:
  • LINEAR_SPACE
  • LOG10_SPACE
  • PROB_SPACE
  • PROBIT_SPACE
  • RECIPROCAL_SPACE
  • OFFSET_RECIP_SPACE
  • LOGIT_SPACE
  • LOGE_SPACE
  • LOG2_SPACE
pinc
[modify] pointer the the increment value
dwCntrl
[Input] Combination of the following bits:
  • RBR_ROUND_TO_MINOR_TICKS, If set then round to tick values else round to step values.
  • RBR_SPECIFY_WIDTH, if set *pinc will be specified and remains the same, else it's only for output.

Return

If this function succeeds, the return value is TRUE, otherwise FALSE will be returned.

Examples

EX1

void RoundBinningRange_ex1()
{
        double min = 4900;
        double max = 7930;
        double xinc; 
        int nSteps = 8; 
        int nSpace = LINEAR_SPACE;
        BOOL bRoundToMinorTick = false;
        RoundBinningRange(&min, &max, nSteps, nSpace, &xinc, bRoundToMinorTick);
        int bins = (max-min)/xinc;
        printf(" Bin Size = %f\n Begin = %f\n End = %f\n Number of Bins = %d\n",xinc, min, max, bins);
}

Remark

See Also

RoundLimits

Header to Include

origin.h

Reference