[Q] Serious API troubling between Python and Mathcad prime - SetMatrixElement(), GetMatrixElement()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
[Q] Serious API troubling between Python and Mathcad prime - SetMatrixElement(), GetMatrixElement()
- Labels:
-
Mathcad Usage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I remember there were a few threads in this forum about exchanging matrices via the API in the past but I am not sure if there ever was a satisfying solution. You may try the search function in the forum to find those threads.
While not specifically covering python, maybe this post can be of help: https://community.ptc.com/t5/PTC-Mathcad/Using-Matrix-with-Prime-3-1-API/m-p/313195/highlight/true#M122230
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I really appreciate it. I will look at it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is there anybody who can reach https://www.ptc.com/en/support/article/CS301830?
The name of article is 'Article - CS301830 How to set a matrix element value using API SetMatrixElement() and SetMatrixValue() in Mathcad Prime'.
It is the right thing for me.
Please help me look at the article.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here you are, but the "article" just consists of the code example which you can also find in the thread I linked to in my first answer.
------------------------------------------------------- snip -------------------------------------------------
How to set a matrix element value using API SetMatrixElement() and SetMatrixValue() in Mathcad Prime
Applies To
- Mathcad Prime 3.1 to 5.0
- API
Description
- How to set a matrix element value using API SetMatrixElement() and SetMatrixValue()
Resolution
- Code example:
var appCreate = new Ptc.MathcadPrime.Automation.ApplicationCreatorClass();
Ptc.MathcadPrime.Automation.ApplicationCreator app;
app = (Ptc.MathcadPrime.Automation.ApplicationCreator)appCreate;
Ptc.MathcadPrime.Automation.IMathcadPrimeWorksheet3 ws;
ws = (Ptc.MathcadPrime.Automation.IMathcadPrimeWorksheet3) app.Open(WorksheetFileName);
int numRows = // whatever;
int numCols = // whatever;
Ptc.MathcadPrime.Automation.IMathcadPrimeMatrix matrixValue = (Ptc.MathcadPrime.Automation.IMathcadPrimeMatrix) ws.CreateMatrix(numRows, numCols);
for (int j = 1; j <= numRows; j++)
{
for (int k = 1; k <= numCols; k++)
{
double valueArg = // In my case I fetch valueArg from some other system here
matrixValue.SetMatrixElement(j - 1, i - 1, valueArg);
}
}
string aliasArg = // whatever
string unitsArg = // whatever;
ws.SetMatrixValue(aliasArg, matrixValue, unitsArg);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It is ridiculous. Even though I coded like the c++ in the above, it still does not work. I do not know where I start from.
--------------------
<Functions>