Hello,
You can refer to http://www.originlab.com/doc/OriginC/ref/vector and http://www.originlab.com/doc/OriginC/ref/vector-Add which can construct a dynamically allocated and sized array.
The following examples shows the way to assign data to a column by Vector and add extra elements to it.
#include <Origin.h>
void main()
{
Worksheet wks;
wks.Create("Origin");
vector<double> vX(10); // vX has 10 elements
for(int ii = 0; ii < 10; ii++)
vX[ii] = ii;
for(int jj = 0; jj < 10; jj++) // add extra 10 elements
{double d = jj;
vX.Add(d);}
Dataset dsA; // Create Origin C Dataset
dsA.Attach(wks,0); // Attach Origin C Dataset object dsA to Origin data set wks(0)
dsA=vX;
}
Best regards,
Jason Zhao
OriginLab Tech Service