Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Automation Interface - Excel

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-24-2006
03:00 AM

07-24-2006
03:00 AM

Automation Interface - Excel

Some good points raised. My fundamental problem is that we have several tens of quality assured Mathcad sheets for certain engineering functions. These are generally configured with fixed (ie single value) inputs. If I want to perform a parametric study, I either need to run a sheet manually several times and record the results (tedious in the extreme) or find a way to run the sheet automatically.

I could re-write the sheets to accommodate an input array, or indeed re-write everything as an Excel spreadsheet, but this will run into the QA problem, which requires time-consuming checking and testing. Ideally, I'd like to change no more than one or two lines in Mathcad, leave the bulk of the calculations untouched, and repeatedly call the sheet from Excel to generate the parametric plots. I just need to be assured that Mathcad completes each calculation before VBA alters the input parameter.

Murray

I could re-write the sheets to accommodate an input array, or indeed re-write everything as an Excel spreadsheet, but this will run into the QA problem, which requires time-consuming checking and testing. Ideally, I'd like to change no more than one or two lines in Mathcad, leave the bulk of the calculations untouched, and repeatedly call the sheet from Excel to generate the parametric plots. I just need to be assured that Mathcad completes each calculation before VBA alters the input parameter.

Murray

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-24-2006
03:00 AM

07-24-2006
03:00 AM

Automation Interface - Excel

On 7/24/2006 4:07:33 AM, manderson wrote:

== My fundamental problem is that we have several tens of quality assured Mathcad sheets for certain engineering functions. These are generally configured with fixed (ie single value) inputs. If I want to perform a parametric study, I either need to run a sheet manually several times and record the results (tedious in the extreme) or find a way to run the sheet automatically.

This kind of problem has arisen before. The following thread might be of some relevance to your problem:

http://collab.mathsoft.com/read?67633,63e#67633

Stuart

== My fundamental problem is that we have several tens of quality assured Mathcad sheets for certain engineering functions. These are generally configured with fixed (ie single value) inputs. If I want to perform a parametric study, I either need to run a sheet manually several times and record the results (tedious in the extreme) or find a way to run the sheet automatically.

This kind of problem has arisen before. The following thread might be of some relevance to your problem:

http://collab.mathsoft.com/read?67633,63e#67633

Stuart

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-26-2006
03:00 AM

07-26-2006
03:00 AM

Automation Interface - Excel

DO you have a system with Mathcad 11 on it? Can you try it on that?

In principle, what you are trying to do sounds very much like MathConnex. MathConnex is not supported in MC12. I don't see how MathConnex could work in MC11 unless the behaviour you observe does not occur there, or they have some way around it. I don't think repeated queries would have been considered a solution.

There is an alternative to using VBA to drive Mathcad. There is a Mathcad add-in for Excel (available from the download site). It allows for the inclusion of a Mathcad work sheet in an Excel spread sheet. Unless it is extremely buggy it must have dealt with the timing issue.

� � � � Tom Gutman

In principle, what you are trying to do sounds very much like MathConnex. MathConnex is not supported in MC12. I don't see how MathConnex could work in MC11 unless the behaviour you observe does not occur there, or they have some way around it. I don't think repeated queries would have been considered a solution.

There is an alternative to using VBA to drive Mathcad. There is a Mathcad add-in for Excel (available from the download site). It allows for the inclusion of a Mathcad work sheet in an Excel spread sheet. Unless it is extremely buggy it must have dealt with the timing issue.

� � � � Tom Gutman

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-26-2006
03:00 AM

07-26-2006
03:00 AM

Automation Interface - Excel

While there is a wait function in Excel, I think it was called "delay," it's a standalone function. so you'd wind up setting the delay to be longer than necessary.

What does work well is to have Mathcad output a dummy file upon completion. You can then get Excel to loop on looking for that file. Once Excel sees the file, it can proceed with its calculations.

TTFN,

Eden

What does work well is to have Mathcad output a dummy file upon completion. You can then get Excel to loop on looking for that file. Once Excel sees the file, it can proceed with its calculations.

TTFN,

Eden

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
04:37 PM

08-02-2010
04:37 PM

Re: Automation Interface - Excel

Speaking of reading or writing to excel .......I have found that I go between excel and MathCAD a lot and every time lately I keep pondering how nice the new functions of MathCAD 15 would be to do this. I have MathCAD 15 and have been playing around with the READEXCEL and WRITEEXCEL functions. I can't seem to get the WRITEEXCEL function to work. The READEXCEL function works great. Does anybody know how to use the WRITEEXCEL function and if so could a very basic example be given? I'm also not sure how the function WRITEEXCEL can direct to which cells the data can be sent to inside the excel worksheet.

I have this: Output3:= WRITEEXCEL("M" , "Inputtest.xlsx") this is an excel 2007 worksheet I have on my desktop just to figure this out.

and M is a 3 by 3 matrix of data. I have tried a scalar vector, vector, tried plain M:=2 (integer), ........and nothing seems to work. MathCAD keeps telling me that it wants a matrix and M is highlighted red.

READEXCEL works fine, I have a column with 20 or so numbers and MathCAD brings them right in.

Input1:= READEXCEL("Inputtest.xlsx" , "Sheet1!A2:A25")

Ron S.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
04:46 PM

08-02-2010
04:46 PM

Re: Automation Interface - Excel

Ron Shoemaker wrote:

I have this: Output3:= WRITEEXCEL("M" , "Inputtest.xlsx")

You have M in quotes, which means Mathcad sees it as a string, not a variable name.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-03-2010
07:33 AM

08-03-2010
07:33 AM

Re: Automation Interface - Excel

Richard,

Thanks for the catch.......but I can't seem to get it to work. I am new to MathCAD.

The end goal is to be able to read a specified cell/cells from excel, apply math/function to the data and then throw it back into excel. The excel sheet preferably would not be embedded. Last night I was able to use the Insert/Component/......and it worked but embedded a worksheet and pulled the data from the excel file on my desktop.

Right now I'm just trying to get data to write into excel, next I will try to find a way to get the data into specified cells. There probably is a way to do this, but haven't come across it yet.

f(x,y):= x^2 +y^2 E:=matrix(4,3,f)

E= (0,1,4.......9,10,13) for the resulting matrix

Output3:=WRITEEXCEL(E, "Inputtest.xlsx") came up red saying This array index is invalid for this array.

Ron S.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-03-2010
07:52 AM

08-03-2010
07:52 AM

Re: Automation Interface - Excel

Ron Shoemaker wrote:

Richard,

Thanks for the catch.......but I can't seem to get it to work. I am new to MathCAD.

The end goal is to be able to read a specified cell/cells from excel, apply math/function to the data and then throw it back into excel. The excel sheet preferably would not be embedded. Last night I was able to use the Insert/Component/......and it worked but embedded a worksheet and pulled the data from the excel file on my desktop.

Right now I'm just trying to get data to write into excel, next I will try to find a way to get the data into specified cells. There probably is a way to do this, but haven't come across it yet.

f(x,y):= x^2 +y^2 E:=matrix(4,3,f)

E= (0,1,4.......9,10,13) for the resulting matrix

Output3:=WRITEEXCEL(E, "Inputtest.xlsx") came up red saying This array index is invalid for this array.

Ron S.

Ron,

I haven't got M15, but have got Prime Alpha 2.0 and managed to get the function to work by copying your exact example. Why don't you try passing a single variable to Excel and see if you get the same error message.

Mike

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-03-2010
08:02 AM

08-03-2010
08:02 AM

Re: Automation Interface - Excel

Could you post an example worksheet showing the problem.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-03-2010
08:28 AM

08-03-2010
08:28 AM

Re: Automation Interface - Excel

Stuart Bruff wrote:

On 7/24/2006 4:07:33 AM, manderson wrote:

== My fundamental problem is that we have several tens of quality assured Mathcad sheets for certain engineering functions. These are generally configured with fixed (ie single value) inputs. If I want to perform a parametric study, I either need to run a sheet manually several times and record the results (tedious in the extreme) or find a way to run the sheet automatically.

Stuart;

I had occasion (several years ago) to need to pass a variable length parameter from EXCEL to Mathcad. To my surprise I discovered that if I selected the range of cells I needed to address In EXCEL, then passed them to Mathcad via the (old) way of an EXCEL macro to a Mathcad in0 variable, what showed up was an array of the selected cell values.

That (along with vectorizing functions) might help your problem.

Fred