Dataset
An Origin C Dataset is a dynamically allocated and sized array that is tied to an internal Origin data set. The internal Origin data set can either be displayed or not displayed in an Origin worksheet column. Dataset is a template class with a default type of double but a Dataset of any basic data type (including char, byte, short, word, int, uint and complex but not string) can be constructed using the syntax Dataset<type>. OVector can be used as a synonym for Dataset. The Dataset class is derived from the vector and vectorbase classes from which it inherits methods and properties.
EX1
void Dataset_ex1() { // The current worksheet must have one column prior to execution Worksheet wks=Project.ActiveLayer(); if (wks) { Dataset dsA; // Create Origin C Dataset object not attached to an Origin data set dsA.Attach(wks,0); // Attach Origin C Dataset object dsA to Origin data set wks(0) dsA.SetSize(5); dsA = 100; //Assign values to dataset. } }
EX2
void Dataset_ex2() { // The current worksheet must have one column prior to execution Worksheet wks=Project.ActiveLayer(); if (wks) { Dataset dsA; // Create Origin C Dataset object not attached to an Origin data set dsA.Attach(wks,0); // Attach Origin C Dataset object dsA to Origin data set wks(0) dsA.SetSize(6); vector vd ; vd.Data(1,5,1); //General data = {1,2,3,4,5}; dsA = vd; //Assign values to dataset from vector. } }
EX3
void Dataset_ex3() { // The current worksheet must have one column prior to execution Worksheet wks=Project.ActiveLayer(); if (wks) { Dataset dsA; // Create Origin C Dataset object not attached to an Origin data set dsA.Attach(wks,0); // Attach Origin C Dataset object dsA to Origin data set wks(0) dsA.SetSize(10); //Assign value by index.. for(int ii = 0; ii < 10; ii++) dsA[ii] = -ii; } }
origin.h