Hello there.
I am currnelty explorign the use of the mathcad API for generating a matrix of data from another application.
I am using VS2010 Professional and VB.NET. I am using the mathCAD API for doing this. I am using MathCAD V14.0.2.5
It appears that there is a limit on the size of the matrix one can create through using the setelement mehtod of the MatrixValue class.
My original matrix was of size 6800 rows x 21 cols. When i try and view this matrix or assign this matrix to a new variable MathCAD shows no vlaue for this matrix. Teh matrix is composed of strings - i ahve to use strings as the data is of a variant/object type i.e. strings/doubles/integers. It seemed to crash when I got ro row 480. For rows less than this i was able to view the matrix in mathcad and assign the matrix to a another user defined valriable as well as extract elements for given indices.
As a test I simply ran a loop for a matrix of 480 rows x 18 columns and assigned an integer value of 1 for every elment. In this instance I was able to get mathcad to read the matrix; hwn trying to display it gave the following:
POINTSMatrix:=BigMatrix{480x19}
If I increase the range to 800x19 I cannot get any value for the matrix. If I use 600x19 it still works
Is there a limit on teh maximum size of a matrix that can be assigned using the SetElement method? IS there a better more efficient way fo assigning data to a very large matrix in mathcad using its API? I want to use the Automation API and not manually do this using table.s
My code for this is given below, I am using ealry bound code, hence Option Explicit = true, and using Ctype statements:
Dim mcdObject AsNewObjectDim mcdPointsMatrix As Mathcad.MatrixValue
Dim mcdMatrixNew As Mathcad.MatrixValue
mcdMatrixNew = CType(Interaction.CreateObject("Mathcad.MatrixValue"), Mathcad.MatrixValue)
Try
mcdPointsMatrix = CType(mcdWorkSheet.GetValue("Points"), Mathcad.MatrixValue)
bMatrixExists = True
Catch ex As Exception
bMatrixExists = False
end Try
For i As Integer = 600 - 1 To 0 Step -1
For j As Integer = 18 To 0 Step -1
If bMatrixExists = False Then
mcdMatrixNew.SetElement(i, j, 1)
Else
mcdPointsMatrix.SetElement(i, j, 1)
End If
Next
Next
If bMatrixExists = False Then
mcdWorkSheet.SetValue("Points", mcdMatrixNew)
Else
mcdWorkSheet.SetValue("Points", mcdPointsMatrix)
End If