Skip to main content
1-Visitor
September 9, 2015
Question

Is there any way to copy a column of data from MS Excel and paste it into a Mathcad matrix?

  • September 9, 2015
  • 4 replies
  • 9935 views

Is there any way to copy a column of data from@ MS Excel and paste it into a Mathcad matrix?

4 replies

23-Emerald V
September 9, 2015

Glen Atlas wrote:

Is there any way to copy a column of data from@ MS Excel and paste it into a Mathcad matrix?

What do you mean by "paste it into a Mathcad matrix"?  Do you mean "insert it into an existing matrix"? Or "create a new matrix"? Or ..?

I haven't got Excel, but using Microsoft's Excel Reader App in Win 10, I just copied a column from an xlsx sheet and pasted it straight into Mathcad 15 as a matrix.  Unfortunately, I don't seem to be able to do that in Prime 3.1.

Stuart

23-Emerald V
September 9, 2015

Oh, in case you didn't know, you could also use the READEXCEL function or Excel component to read data straight from a worksheet.

Stuart

25-Diamond I
September 9, 2015

Glen Atlas wrote:

Is there any way to copy a column of data from@ MS Excel and paste it into a Mathcad matrix?

Yes, its easy.

Copy the column(s) in Excel via Ctrl-C.

In Mathcad simply type M: and then, when the cursor is in the placeholder after the := insert via Ctrl-V. This will create a Mathcad vector/matrix.

If you meant pasting it as part of an already existing matrix, I guess the answer is no, as you will end up with the whole column(s) being just one element of that matrix.

If you press Ctrl-V without creating a placeholder you insert an Excel-Object in your Mathcad sheet.

BTW, I am talking of real Mathcad (that is version 15 and below) - not about Prime. It doesn't work in Prime that way.

If you simply paste in Prime you get a table, which might be what you want but if you try to paste it after M:= it doesn't work at all. What an improvement.

Of course you can always import your data via Excel component or using READEXCEL.

gatlas-21-VisitorAuthor
1-Visitor
September 10, 2015

Thanks. I knew I could copy from excel into Mathcad 15. I thought I could do it with Prime... No big deal as I prefer Mathcad 15 anyway.

24-Ruby IV
September 10, 2015

Glen Atlas wrote:

Thanks. I knew I could copy from excel into Mathcad 15. I thought I could do it with Prime... No big deal as I prefer Mathcad 15 anyway.

Copy from Excel into Mathcad 15, save the sheet and convert it into Prime!

1-Visitor
September 10, 2015

You could just call the data from Excel into Mathcad and then select the column.

23-Emerald I
September 10, 2015

You can insert an EXCEL component into Prime, then copy and paste from EXCEL to {EXCEL in Prime}, you can then define an output variable that addresses the range of the EXCEL sheet and viola--a vector or matrix.   S o o o much easier than copy/paste!

SPaulis
14-Alexandrite
June 23, 2022

Sorry @Fred_Kohlhepp , not s o o o easy.  A cut and paste into a plain matrix would be the easiest.  Cut and pasting between apps is very old school but simply not yet implemented in Prime--they are not on the ball with so many simple concepts in Prime (sadly even today in Prime 8).  Almost any 'table-like' structures in other apps can accept pasting of tab-delimited tables (Excel, Word, Smartsheets (online spreadsheets), AutoCAD, Google Docs, at least these are the ones I have used).  

 

Having an excel component only makes things worse (not as elegant) and I have to provide output definitions.  I don't have Mathcad 15 to take the longer route as I can't afford both licenses at once.  And I can't paste it as a table because I need it as a 2D matrix and not multiple column vectors.

 

In my case I have a large 34x17 matrix that I want to enter into Prime so that you can see it is stand alone matrix.  I cannot link it to a file because I want to distribute it as a stand-alone calculation sheet.  It also has mixed data of strings, numbers and empty elements (NAN's). 

 

Right now I use a keypress macro to 'type' the data into the Mathcad matrix.  It is still not superior to the computer industry standard of "cut and paste".

"It's OK to fall in love with your heart, but you design with your head." Omer W. Blodgett
23-Emerald IV
June 24, 2022

Example for a table in Excel:

LucMeekes_2-1656058630568.png

It's silly that Prime doesn't allow to copy-paste such a table to a matrix definition instantly,

LucMeekes_3-1656058763656.png

like Mathcad does:

LucMeekes_4-1656058806298.png

Copy from Excel to paste in Prime in a blank location results in a table, as Jeff explained. You can convert that table to a matrix by augmenting the table colums. This 'll work fine for a limited amount of table columns:

LucMeekes_0-1656058423527.png

But for a large number of colums it's a bit tedious. There's another way.

Copy the table over from Excel to notepad, and save that text file:

LucMeekes_5-1656058870822.png

Now you can read it into Prime with:

LucMeekes_6-1656058976584.png

Once you have the Matrix in Prime, you can copy it and use it in a definition of a matrix, if you want the worksheet to be self-contained.

 

Success!
Luc