Skip to main content
3-Newcomer
Question

API - Load MathCAD Matrix with JScript

Does anybody know the correct code for reading out matrix content with JScript in MathCAD when loading it through the API? 

 

This is the MathCAD simplified example in MathCAD Prime 11.

AR_13342474_0-1757674399766.png

AR_13342474_2-1757675336050.png

 

 

This is the code in the button:

AR_13342474_1-1757674576215.png

 

Reading a matrix value like this works excellent when loading the Matrix as a normal input variable without API.

 

Other API functions works fine, like for instance Worksheet.Output.GetValue("EampleNumber").RealResult

 

 

 

 

 

 

8 replies

terryhendicott
21-Topaz II

Hi,

Try matrixFirstValue = matrix(0, 0)

Cheers

Terry

Translate
3-Newcomer

Hi,

Thank you for your proposal. 

 

Unfortunately I get another error message: "Object doesn't support this property or method".

 

I tried both comma and dot as separator just to make sure.

 

AR_13342474_1-1757682527288.png

 

 

Translate
23-Emerald V

I'm not sure that your variable matrix is a proper JScript array.  I think it might be a different kind of object.

 

Try result = matrix.GetMatrixElement(0, 0, mydata);  (result and mydata are arbitrary names)

 

Stuart

 

(Any chance you could post the worksheet with your example, please?  I've probably made a typo as I can't get the number of rows or columns, let alone a matrix value)

Translate