2.2.3.6.1 Dataset::Append

Description

Append data from a vector or Dataset object to this Origin C Dataset object and update the Origin data set from this Origin C Dataset object.

Syntax

BOOL Append(vector& v, int iMode = REDRAW_NONE)

Parameters

v
[input] vector or Dataset to append
iMode
[input] Dataset update mode, allowed values are
REDRAW_NONE, do not update
REDRAW_REALTIME, graph realtime drawing, only the new added data will be drawn
REDRAW_REALTIME_WKS, do a simple refresh of the data
REDRAW_REFRESH, similar to REDRAW_REALTIME_SCOPE, but redraw the entire worksheet
REDRAW_REALTIME_SCOPE, this is used to do realtime drawing for the entire range of data.
To see effect in plots, must set dataplots to animate mode

Return

Returns TRUE on successful exit and FALSE on failure.

Examples

EX1

// Assume a worksheet and with A(X) and B(Y)
void Dataset_Append_ex1()
{
    int npts = 20;
    static int nn = 1;
    Worksheet wks=Project.ActiveLayer();
    if (wks)
    {       
        Dataset aa(wks,0);
        Dataset bb(wks,1);
 
        vector a(npts);
        vector b(npts);
 
        for(int ii = 0; ii < npts; ii++)
        {
            a[ii] = nn++;
            b[ii] = rnd();
        }
 
        aa.Append(a, REDRAW_REFRESH);
        bb.Append(b, REDRAW_REFRESH);
    }
    return;
}

EX2

// Prepare a worksheet, fill A(X) and B(Y) with 0.5 
// High light B(Y) to plot a scatter graph, 
//(1)set plot active and then execute LabTalk script command "set %C -an 1"
//(2)then active worksheet to execute the code

void Dataset_Append_ex2()
{
	int times = 50;        
    Worksheet wks=Project.ActiveLayer(); 
    if (wks)
    {       
        Dataset aa(wks,0);
        Dataset bb(wks,1); 
        
        for(int ntime = 0; ntime < times; ++ntime)
        {
        	int npts = 20;
			vector a(npts);
			vector b(npts);
	 
			for(int ii = 0; ii < npts; ii++)
			{
				a[ii] = rnd();
				b[ii] = rnd();
			}
	 
			aa.Append(a, REDRAW_REALTIME_SCOPE);
			bb.Append(b, REDRAW_REALTIME_SCOPE);
        }
    }
    return;
}

Remark

See Also

vectorbase::Append, Dataset::Update

Header to Include

origin.h