Let's say I have two columns in an Excel document containing variable names (column A) and their associated values (column B). Is it possible to import these into MathCAD without having to type out each variable name? I've tried to finagle the excel component to do what I want but it seems no matter what I try I end up having to type the variables out by hand. This gets cumbersome because I tend to work with a lot of variables that I'd love to have auto imported.
Other posts have shown that variables cannot be auto-generated in Prime.
You can import the list of variables as an array of strings and their values as a multi-columned array. The index of the string array that points to the variable name then also points to the column of values.
This is undocumented but it works. Mathcad Prime files are a zip file of xml files but with an mcdx extension. You can alter the file extension to "zip" and the internal collection of xml files can be read by winrar or other compression software.
Within the zip file is a folder "mathcad". Within this folder is a file called "worksheet.xml". Within this file is a part called "regions". Within this part are numbered regions that define variables and their values.
It is possible to construct in excel this part of the file with as many variable names and values you wish. You need to change the id, top, variable name and value on each excel row. Enclosed is an example. You save the excel file (worksheet only) as formatted text *.prn. Then use a text editor to copy the text into the xml file between the <regions> </regions> part indicators. Rename the xml extension as mcdx again and hey presto when you open in Mathcad the variables will be there.
Certainly easier that typing the variable names into mathcad. 😉
Thanks for the response! I am actually aware of manipulating the XML code of the MathCAD files in order to do what I am suggesting (I actually have an old MathCAD 15 python script that does what I am asking). I was mostly wondering if MathCAD Prime has a built in solution to this, or if anyone has found a more elegant solution than manually editing the XML code. As the other user indicated, I don't seem to be the only one looking for this kind of functionality.