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

Dynamic Excel Component with Mathcad

JC_4829422
2-Explorer

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.
6 REPLIES 6
LucMeekes
23-Emerald III
(To:JC_4829422)

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

 

Success!
Luc

Werner_E
25-Diamond I
(To:JC_4829422)

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.

DJF
16-Pearl
16-Pearl
(To:Werner_E)

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.    

Fred_Kohlhepp
23-Emerald I
(To:DJF)

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

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.

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

Announcements

Top Tags