Put two dimensional data into a specified Origin matrix.
VB: Function PutMatrix(Name As ByVal String, data As ByVal Object ) As Boolean
C++: bool PutMatrix(LPCSTR Name, _variant_t data )
C#: bool PutMatrix(string Name, var data )
[<bookName>]<sheetName>!<objIndex>
The PutMatrix method returns true if successful else false.
'Assumes Matrix1 exists. Dim oApp As Origin.ApplicationSI Dim bb As Boolean Dim mat(5, 1 To 2) As Long Set oApp = GetObject("", "Origin.ApplicationSI") 'Create sample data For i = 0 To 5 For j = 1 To 2 mat(i, j) = i + j Next j Next i bb = oApp.PutMatrix("Matrix1", mat)
using Origin; static bool TestPutMatrix() { Origin.ApplicationSI originApp = new Origin.ApplicationSI(); int nNumRows = 100; int nNumCols = 100; // Create some data to put into the matrix. double[,] data = new double[nNumRows, nNumCols]; for (int nRow = 0; nRow < nNumRows; nRow++) for (int nCol = 0; nCol < nNumCols; nCol++) data[nRow, nCol] = (double)(nCol + nRow); // Start a new Origin project. originApp.NewProject(); // Create a new matrixbook. MatrixPage mpg = originApp.MatrixPages.Add("origin", System.Type.Missing); // Get the first matrix sheet in the new book. MatrixSheet msht = mpg.Layers[0] as MatrixSheet; msht.Rows = nNumRows; msht.Cols = nNumCols; // Construct a full sheet name to pass to PutMatrix. string strMSheetName = "[" + mpg.Name + "]" + msht.Name; // Put the data into the matrixsheet. return originApp.PutMatrix(strMSheetName, data); }
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