2.2.4.48.10 XYRange::SetData

Description

It sets x, y, y error data from XYRange.

Syntax

BOOL SetData( vector * pvY, vector * pvX, int nIndex = 0, vector * pvYErr = NULL, DWORD dwDRSOpts = DRS_KEEP_LARGER_DEST_SIZE )

Parameters

pvY
[input]the Y-independent data
pvX
[input]the X independent data
nIndex
[input]the data index
pvYErr
[input]optional output of Y Error data
dwDRSOpts
[input]the rules for setting data from DRS_enumeration.

Return

TRUE if success.

Examples

EX1

// Set only XY, without error column, to A(x), B(y).
void XYRange_SetData_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    XYRange xy;
    xy.Add(wks, 0, "X");
    xy.Add(wks, 1, "Y");
    vector vx = {1,2,3};
    vector vy = {5,6,7}
    xy.SetData(&vy, &vx);
}

EX2

// Set X, Y and YError column to A(x), B(y), C(yerr).
void XYRange_SetData_Ex2()
{
	WorksheetPage wksPage;
	wksPage.Create("Origin");
	
	Worksheet wks = wksPage.Layers();
	wks.AddCol();
    
    XYRange dr;
    if( wks )
    {
        dr.Add("X", wks, 0, 0, -1, 0);
        dr.Add("Y", wks, 0, 1, -1, 1);
        dr.Add("ED", wks, 0, 2, -1, 2);        
        
        int nIndex = 0;
        vector vX = {1,2,3,4,5};
        vector vY = {1,2,3,4,5};
        vector vErr = {0.1,0.2,0.3,0.4,0.5};
        dr.SetData(&vY, &vX, nIndex, &vErr);
    }    
}

Remark

See Also

XYRange::GetData, DataRange::GetNumData, DataRange::GetData, DataRange::SetData, DataRange::GetMaskedData, DataRange::GetMissingData

Header to Include

origin.h