2.25.17 SetData


Description

Send a 2D array to an Origin Matrix Object.

Syntax

VB: Function SetData(data As ByVal Object, [ nRowOffset As ByVal Object ], [ nColOffset As ByVal Object ] ) As Boolean
C++: bool SetData(_variant_t data, _variant_t nRowOffset, _variant_t nColOffset )
C#: bool SetData(var data, var nRowOffset, var nColOffset )

Parameters

data
2D array of variant or numeric
nRowOffset
0 offset index to start, use 0 for entire matrix
nColOffset
0 offset index to start, use 0 for entire matrix

Return

Remark

Examples

VBA

to send 2D array of double to active matrix object

    Const NumRows = 10
    Const numCols = 15
    Dim org As Origin.Application
    Dim app As Origin.Application
    Dim msht As Origin.MatrixSheet
    Dim mo As Origin.MatrixObject
    
    Set app = New Origin.ApplicationSI
    Set msht = app.FindMatrixSheet("")
    If msht Is Nothing Then
        MsgBox "No active matrix book found"
        Exit Sub
    End If
    Set mo = msht.MatrixObjects(0)
    
    Dim nn As Boolean
    Dim ii, jj As Integer
    
    Dim dd(1 To NumRows, 1 To numCols) As Double
    '-------- prepare sample data array ------------
    For ii = 1 To NumRows
        For jj = 1 To numCols
            dd(ii, jj) = ii * 10 + jj * 0.03
        Next jj
    Next ii
   
    '---------Prepare the Matrix Object---------------
    mo.DataFormat = DF_DOUBLE
    msht.Cols = numCols
    msht.Rows = NumRows
    '--------- now we call SetData --------------
    nn = mo.SetData(dd, 0, 0)

Version Information

8.0SR2

See Also

GetData