DataObject::SetMissingValue

Description

Set the missing value of the DataObejct.

Syntax

BOOL SetMissingValue( LPVOID pVal = NULL )

Parameters

pVal
[input] point to the data to be set as missing value, the size of data should be same as data size of the data oboject.
NULL to clear internal buffer, which means missing value cannot be 0.

Return

True for success; otherwise false.

Examples

EX1

void DataObject_SetMissingValue_Ex1()
{
        WorksheetPage     wksPage;
    wksPage.Create("origin");
    Worksheet     wks = wksPage.Layers();
 
    Column     col(wks, 0);
    if(col)
    {
            vector& vec = col.GetDataObject();
            double     dMissing = 1e-10; // defined by user
                vec.Data(1, 10, 1);
            vec[0] = dMissing;
        bool    bb = col.SetMissingValue(&dMissing);
        Dataset ds(col);
        if(bb && ds.GetSize() > 0 && is_equal(dMissing, ds[0]) )    
            printf("Fill in missing values to col %s successfully.\n", col.GetName());
        else
            printf("Fail to set missing!\n");
        
    }
}

EX2

void DataObject_SetMissingValue_Ex2()
{
        MatrixPage mp;
        mp.Create("origin");
    MatrixLayer ml = Project.ActiveLayer();
    if ( !ml )
    {
        printf("Can not access active matrixsheet");
        return;
    }
    MatrixObject mo = ml.MatrixObjects(0); //get first matrixobject
    double dMiss = 1e-12;
    mo.SetMissingValue(&dMiss);
    if ( mo.GetMissingValue(&dMiss) )
        printf("Missing value in this matrixobject is set as %.15lf\n", dMiss);
}

Remark

See Also

DataObject::GetMissingValue

Header to Include

origin.h