8.1.6.2 DataRange::AddMatrix

It is recommended that you switch to the originpro package. PyOrigin is primarily for users who need to work with Origin version prior to 2021.


Description

Add an matrixobject of the matrixsheet to datarange

Syntax

AddMatrix(Matrix, Index = 0)

Parameters

Matrix
Origin Matrixsheet
Index
Sheet index

Return

Returns the number of matrixsheet in the matrixbook after execution.

Examples

EX1

#prepare a matrixbook Mbook1 and a Graph Graph1 for test
import PyOrigin
data=PyOrigin.NewDataRange()
pArr2D = [[x for x in range(32)] for x in range(32)] 
MatrixPage=PyOrigin.MatrixPages('MBook1')
MatrixPage.Layers('MSheet1').MatrixObjects(0).SetData(pArr2D, 0, 0)
data.AddMatrix(MatrixPage.Layers('MSheet1'))
gp = PyOrigin.FindGraphLayer('Graph1')
gp.AddPlot(data, 226)