Turn on suggestions

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

Showing results for

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

Showing results for

** Community Tip** - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search.
X

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

Jan 08, 2021
01:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 08, 2021
01:23 AM

Dynamic Excel Component with Mathcad

I am using Mathcad Prime 6.0 6.0.0.0

I'm trying to learn the capabilities of using the excel component with Mathcad. Is it possible to start with an excel component to obtain certain output variables, read that into Mathcad, and then return value(s) back into the same component in excel to continue some calculation process.

i.e. Get "A" and "B" values from the excel component, manipulate the values of A & B to obtain values for a "C" variable. And then read/output the "C" value into the same excel component?

Here are the errors that I faced

when I try to create the loop functionality described above I get the "Variable undefined" for the "C" value I'm trying to send back to excel.

I'm trying to learn the capabilities of using the excel component with Mathcad. Is it possible to start with an excel component to obtain certain output variables, read that into Mathcad, and then return value(s) back into the same component in excel to continue some calculation process.

i.e. Get "A" and "B" values from the excel component, manipulate the values of A & B to obtain values for a "C" variable. And then read/output the "C" value into the same excel component?

Here are the errors that I faced

when I try to create the loop functionality described above I get the "Variable undefined" for the "C" value I'm trying to send back to excel.

6 REPLIES 6

Jan 08, 2021
04:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 08, 2021
04:54 AM

Please attach your Prime and excel worksheets, so we may be able to help you.

Success!

Luc

Jan 08, 2021
07:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 08, 2021
07:58 AM

As Prime is reading the worksheet from top to down, I don't think that its possible to write back the result to the very same Excel __component.__To do this you would have to turn the component into some sort of function which, as far as I know, is not possible.

But of course you always can read in an external Excel file with READEXCEL, make your calculations and after that write back the result using WRITEEXCEL to the very same Excel file. But this also means that your Prime file would not be self-contained and you have to deal with two files, Prime and Excel.

Jan 08, 2021
09:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 08, 2021
09:38 AM

I tend to agree with Werner. One idea is that a global definition might work to rewrite variables. But I can't seem to get it to work (in the 5 minutes I devoted to it.) Apparently you can't use global definitions inside of programs.

Jan 08, 2021
10:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 08, 2021
10:03 AM

I don't think you can define a global variable as a calculation using a non-global variable. (Nice idea, though!)

Jan 08, 2021
10:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 08, 2021
10:09 AM

Long ago (*really long, circa 1995)* there was a Mathcad plug-in for EXCEL (you inserted your Mathcad sheet as a component into the EXCEL sheet. Then, using the scripting in EXCEL you could paste data into Mathcad and extract computation results. Mathcad used to have inputs (IN0, IN1, etc) and outputs (OUT0, Ozut1, etc) to define where things came in and were extract3ed from.

That capability disappeared several EXCEL iterations ago, and I don't think Prime would support it anyway. There still might be a way to script this in version 15, but it would take someone with more knowledge than I.

Jan 09, 2021
02:11 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 09, 2021
02:11 AM

Thanks for your comment(s). I suspected there was no current way to create a dynamic loop between Mathcad and an excel component where you could send values back and forth as required. But since I don’t consider myself a Mathcad expert I figured I would ask more knowledgeable users. I did try to use a global definition but the program would not permit that. I guess you have to keep creating copies of the excel component to continue your calculations top-down, as necessary.

Thanks