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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Extracting values from excel to enter into matrix

AS_9781967
8-Gravel

Extracting values from excel to enter into matrix

I have data in excel and I want to copy that data and use as matrix in Mathcad prime ? Is this something possible how can I do that? Let's say I have 10 rows and 100 columns and want to copy paste it in matrix is there a simpler way? Due to the nature of data I am unable to share here if anyone has a sample data to show me how that can be done it would be great!

4 REPLIES 4
Werner_E
25-Diamond I
(To:AS_9781967)

You could use copy&paste, but you will end up with something that PTC calls a 'table' - basically 100 individual columns in your case, which might not be very handy as you would have to augment them to get the desired matrix.

I would suggest using the Mathcad/Prime function READEXCEL to import the data directly into a Prime matrix/array.

To Import Data from Excel

Excel Data Files

 

LucMeekes
23-Emerald III
(To:Werner_E)

You could transpose the data in Excel before you copy and paste it into the Prime sheet. That would result in a table with only 10 columns (with 100 rows each)...

But I (too) think the better method is through READEXCEL.

 

Success!

Luc

StuartBruff
23-Emerald III
(To:AS_9781967)

If you have a need to paste the Excel data into a Mathcad worksheet, then you could try using Mathcad's Excel Component. 

 

You go to the Input/Output menu, insert an Excel Component, double-click on the component to open it, paste the data into the component, and close it.   The Excel data is now available to you.   Note: do not have the Excel application open when you use the Mathcad, otherwise the Mathcad Excel Component will squawk like a verbose parrot.

 

The Mathcad Excel Component makes its data available via the variable excel.  Ranges of data are extracted using standard Excel range notation as excel's index.

 

In this example, I did what I said above and pasted Excel data into the Excel Component, then retrieved it into a variable Matrix.

 

2024 10 22 C.png

 

Here, I used the Excel Component as a means of formatting the Mathcad-generated data, and then performed some simple (and inefficient) processing on the data after getting it back from the Excel Component.  I applied conditional formatting to the data to show numbers less than -0.25 in red and numbers above -0.25 in green.  Changing the input numbers changes the cell values but doesn't affect the cell formatting, consequently the new values are displayed according to their cells' conditional formatting. 

 

2024 10 22 D.png

 

Stuart

Hi @AS_9781967,


I wanted to see if you got the help you needed.


If so, please mark the appropriate reply as the Accepted Solution or please feel free to detail in a reply what has helped you and mark it as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.


Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina
PTC Community Moderator
Announcements

Top Tags