| 2.5.21 SetEvenSampling
 DescriptionSet sampling settings of one column
 Syntax
VB: Function SetEvenSampling(X0 As ByVal Double, XInc As ByVal Double, [ Units As ByVal Object ], [ LongName As ByVal Object ], [ DispFormat As ByVal Object ] ) As Boolean
C++: bool SetEvenSampling(double X0, double XInc, _variant_t Units, _variant_t LongName, _variant_t DispFormat )
C#: bool SetEvenSampling(double X0, double XInc, var Units, var LongName, var DispFormat )
ParametersX0The initial value of X.XIncThe increment of X.UnitsA string of the unit of X axis. For example, if X axis is a time line, then the Unit could be "ms".LongNameA string of the LongName of X axis. For example, "Time".DispFormatA string of display format of numbers. For example, "%8.2f"
 ReturnA boolean value with true indicating set successfully and false indicating it is failed.
 RemarkExamplesVBAConnect to the running Origin. Set the interval of samples in Column(0) as 20ms, and send data to the column. You can see the result in Origin. Then, Get the sample rate of the column and output it.
 Public Sub SetEvenSampling()
    Dim app As Origin.ApplicationSI
    Dim Wks As Origin.Worksheet
    Dim Data(1 To 100) As Double
    Dim ii As Integer
    For ii = 1 To 100
        Data(ii) = ii * 0.12 + 3.75
    Next
 
    Set app = New Origin.ApplicationSI
    Set Wks = app.FindWorksheet("")
 
    'Set a time line, which unit is ms, starting from 0 and sample interval is 20 ms, and display format is default
    ii = Wks.Columns(0).SetEvenSampling(0, 20, "ms", "Time", "")
 
    'Send data to the column
    Wks.Columns(0).SetData (Data)
 
    'Get the sample rate of the column, and output it to the Excel sheet
    Range("A1") = Wks.Columns(0).EvenSampling
 
End SubC#Using Origin;
static void SetEvenSampling()
{
    double[] Data = new double[100];
    for (int ii = 0; ii < 100; ii++)
    {
        Data[ii] = ii * 0.12 + 3.75;
    }
    Origin.ApplicationSI app = new Origin.ApplicationSI();
    Worksheet wks = app.FindWorksheet("");
    //Set a time line, which unit is ms, starting from 0 and sample interval is 20 ms, and display format is default
    wks.Columns[0].SetEvenSampling(0, 20, "ms", "Time", "");
    //Send data to the column
    wks.Columns[0].SetData(Data, 0);
    //Get the sample rate of the column, and output it to console
    Console.WriteLine(wks.Columns[0].EvenSampling);
    Console.ReadLine();
}Version Information8.0SR2
 See AlsoSetData | EvenSampling
 |