The GetMatrix method transfers data from specified Origin matrix.
VB: Function GetMatrix(Name As ByVal String, [ format As ByVal Object ] ) As Object
C++: _variant_t GetMatrix(LPCSTR Name, _variant_t format )
C#: var GetMatrix(string Name, var format )
[<bookName>]<sheetName>!<objIndex>
Returns data as two dimensional safearray of doubles.
'Assumes Matrix1 exists and contains data. Dim oApp As Origin.ApplicationSI Set oApp = GetObject("", "Origin.ApplicationSI") array = oApp.GetMatrix("Matrix1")
public void GetMatrix() { Origin.IOApplication pOrigin; object mtx; pOrigin = new Origin.ApplicationSIClass(); mtx = pOrigin.GetMatrix("MBook1", 0); //matrix with book name of MBook1 int dd = -1; //if fail to get matrix, it mtx will be minus value if ( mtx == null || mtx.GetType() == dd.GetType() ) { return; //can not get matrix } double[,] data = mtx as double[,]; System.Console.WriteLine(data[1, 1]); //first cell of the first column } static void Main(string[] args) { Program p = new Program(); p.GetMatrix(); }
import OriginExt as O app = O.Application(); app.Visible = app.MAINWND_SHOW pageName = app.CreatePage(app.OPT_MATRIX) mp = app.MatrixPages(pageName) ms = mp.Layers(0) # Set number of matrix objects ms.Mats = 1 # Set the dimension of matrix ms.Rows = 3; ms.Cols = 2 # Set the data of matrix object testData = [[5,87,90], [3.14, 24.6, 68.09]] app.PutMatrix(pageName, testData) outputData = app.GetMatrix(pageName)
8.0SR2