2.2.3.6 Dataset


Name

Dataset

Remark

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.

Hierarchy

Examples

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;
    }
}

Header to Include

origin.h

Reference

Members

Name Brief Example
Attach Attach Dataset object to an Origin data set identified by name. Examples
Append 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. Examples
Create Create an internal Origin data set (may or may not be temporary). Examples
Dataset Default constructor for Dataset class. Examples
Destroy Detach the Origin C Dataset object and Destroy (delete) the internal Origin data set. Examples
Detach Detach the Dataset object from an internal Origin data set. Examples
GetName Get the name of an internal Origin data set. Examples
GetStringArray Copy the contents of a Text Dataset into a StringArray. Examples
GetText Get the text value of a cell in an Origin data set of type Text & Numeric. Examples
IsValid Checks the validity of an Origin C Dataset object. Examples
PutStringArray Put (copy) the contents of a StringArray to a Text Dataset. Examples
SetLowerBound Set the lower display index of the Dataset. Examples
SetText Set the text value of a cell in an Origin data set of type Text & Numeric. Examples
SetUpperBound Set the upper display index of the Dataset. Examples
Update Update an Origin C Dataset object from an Origin data set or vice-versa. Examples