2.1.17.2.2.2 Curve_MinMax


Description

Get X and Y range of the Curve.

Syntax

BOOL Curve_MinMax( const curvebase * pcuvData, double * pxMin, double * pxMax, BOOL bScanData = FALSE, double * pyMin = NULL, double * pyMax = NULL )

Parameters

pcuvData
[input] Pointer to Curve
pxMin
[output] pointer to double for X min, NULL if no need to get this value
pxMax
[output] pointer to double for X max, NULL if no need to get this value
bScanData
[input] TRUE will scan both XY dataset of the curve for min and max,
FALSE will reuse internal cached values. Typically there is no need to scan
unless data has changed
pyMin
[output] pointer to double for Y min, NULL if no need to get this value
pyMax
[output] pointer to double for Y max, NULL if no need to get this value

Return

True for success

Examples

EX1

// This is a self contained sample program for the function Curve_MinMax, 
// Its sample data is created at the beginning of the program. 
// To run the program, enter the following command in the Script window:
//   Curve_MinMax_ex1
// It returns a message like the following line:
//   Data ranges of Data2  X: Min=1, Max=7  Y: Min=0.097, Max=0.64529

void Curve_MinMax_ex1()
{    
    double xMin,xMax,yMin,yMax;
    string wksName;
    BOOL rc;

    Worksheet wks;
    wks.Create();
    wksName=wks.GetPage().GetName();
    Dataset myInXDs(wks,0);
    Dataset myInYDs(wks,1);
    
    //******* Create sample data *****************
    myInXDs.SetSize(7);
    myInYDs.SetSize(7);
    myInXDs[0]=1;    myInYDs[0]=0.097;
    myInXDs[1]=2;    myInYDs[1]=0.41256;
    myInXDs[2]=3;    myInYDs[2]=0.24909;
    myInXDs[3]=4;    myInYDs[3]=0.47304;
    myInXDs[4]=5;    myInYDs[4]=0.2476;
    myInXDs[5]=6;    myInYDs[5]=0.64529;
    myInXDs[6]=7;    myInYDs[6]=0.44514;
    //******** End of Sample Data Creation *******

    Curve cuvData(wks,0,1);

    BOOL bScanData = FALSE;  // No scan for XY datasets
    rc = Curve_MinMax(&cuvData,&xMin,&xMax,bScanData,&yMin,&yMax); //Demonstration of Curve_MinMax
        
    if(rc)
        printf("Data ranges of %s  X: Min=%g, Max=%g  Y: Min=%g, Max=%g\n",
          wksName,xMin,xMax,yMin,yMax);
    else
        printf("Curve_MinMax Failed.\n");
}

Remark

The function used for fitting function parameter initialization.

See Also

Header to Include

origin.h

Reference