cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

Creating equations using data from Excel in Prime 9

PF_14048166
2-Explorer

Creating equations using data from Excel in Prime 9

As an electrical engineer who performs worst case analysis of electrical circuits, I'd like to automate this task.  I'd like to take a parts list in Excel, and have Mathcad create the definitions for each part.  For example, my parts list has R1, 100 ohms.  I want Mathcad Prime to make the equation R1:=100Ω.

 

Is there a way to do this?

2 REPLIES 2
Werner_E
25-Diamond I
(To:PF_14048166)

I would suggest that you read in the data via READEXCEL.

If you have the values of, for example, three resistors in cells B2 to B4, you could read all three into three variables in one go and immediately assign them the correct unit.

Werner_E_0-1756147362303.png

In this example I used literal indices, so creating three different variables. Of course you also could read in the data in just one vector whose elements you can access using vector/matrix indices. As I usually never change the value of the system variable ORIGIN from its default value zero, the first elelement is accessed with index 0

Werner_E_1-1756147556109.png

 

 

StuartBruff
23-Emerald IV
(To:Werner_E)

Hi Werner,

 

Another option might be to use the Excel-to-Python-Function converters and see if the resulting output can be massaged into a suitable form for automation via one of the Advanced Controls (now that the Python Scripting Language is available - I haven't tried it yet).

 

Alternatively, somebody (ie, not me) could try writing a script to create a worksheet using the Excel names to plug in regions with appropriately-named variables.   But that sounds like work.

 

Stuart

Announcements

Top Tags