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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Excel and Mathcad linking

ptc-4626292
1-Newbie

Excel and Mathcad linking

Hi Everyone!

I've been using Mathcad for a while and I believe it is a powerful tool. But in the last week I've been experiencing a problem. I need to create a dynamic link between Excel and Mathcad as the raw data I am working with is too much to be just copied or imported. There is a constant 'flow' of new information going straight into the excel file and I need it to be linked directly to Mathcad. (as we are talking here about thousands of results).

Will be very grateful if you can help me out! Thank you very much in advance!

Kate

9 REPLIES 9
PeterKehoe
5-Regular Member
(To:ptc-4626292)

You might want to post this to the Mathcad site, not the one for Creo Elements/Direct Modeling.

Kate SS wrote:

Hi Everyone!

I've been using Mathcad for a while and I believe it is a powerful tool. But in the last week I've been experiencing a problem. I need to create a dynamic link between Excel and Mathcad as the raw data I am working with is too much to be just copied or imported. There is a constant 'flow' of new information going straight into the excel file and I need it to be linked directly to Mathcad. (as we are talking here about thousands of results).

Will be very grateful if you can help me out! Thank you very much in advance!

Kate

Hi Kate,

Can you give a bit more detail about what it is that you need to do in terms of reading, writing and possibly viewing your data? How many rows of data are you dealing with and what is the format? Have you tried using the WRITEEXCEL and READEXCEL functions in M15?

Stuart

Well..

Rows are different every time- the last time they were 1500. And that is why it wasn't very useful just copying them. Also part of the informatioin and the formulas were set in Excel and some of the results obtained should be extracted as well. That is why I wanted a dynamic link where one is not supposed to copy or input the data every time but it is just automatically inputting. Then after Mathcad finishes the calculations the end results can be returned to the excel sheets.

In other words, Mathcad is just the model which executes the calculations because the formulas are too complicated to be put into Excel, but at the end everything goes back into the Excel sheets and one has a good set of data. And as you can see, doing that for 1500 rows every time is just too much unnecessary work.

Kate,

Try this thread for one method, pasting links to your main worksheet into a Mathcad component: http://communities.ptc.com/message/39965#39965 (look for jcc's message).

Stuart

I thought there should be a way for that to happen because Mathcad uses Fortran and I've been programming on Pascal. And there you can just establish such a link and every time you run the program, it automatically calculates the values you need and puts them somewhere you want.

RichardJ
19-Tanzanite
(To:ptc-4626292)

I thought there should be a way for that to happen because Mathcad uses Fortran

Not sure where you got that idea. Mathcad doesn't use Fortran for anything.

If you just want Mathcad to do the calculations, but the input data is form Excel and the results are to be displayed in Excel, then what you probably want to do is call Mathcad from Excel. I have attached a really simple example of a VBA program that calls a Mathcad worksheet.

Hi Kate,

there are several ways, but I will give you one that works (I'm referring to MC 15)

  1. Right-Click somewhere on your worksheet. Choose "Insert..." from the context menu
  2. Choose the topic "File Input..."
  3. Choose "Microsoft Excel" in the topmost menu. As a default it should already show "Microsoft Excel".
  4. Click on browse and choose the file location for your source data
  5. Click Finish (here you can choose where in the source file to start reading data. If omitted, it simply starts at the first cell.
  6. A "diskette" symbol appears (does
  7. anybody remembers those anymore?) with a small black rectangle at the top left of the symbol. This is the place where you may wish to define your array (i.e. name it) such as DATA. This can be called up by simply writing DATA = ...

This process can also be inversed i.e. to write out data. However, if the Excel file is open you can't neither read nor write from/to it.

Hope this helps

Raiko

Search about

SetComplex and GetComplex functions 

you will find your answer

good luck

babakmz@gmail.com

Not sure if this will help the original poster.

Note that the thread started some 5 years ago...

 

Luc

Top Tags