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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

exporting equation's results from one mathcad file to other

rdelascasas
6-Contributor

exporting equation's results from one mathcad file to other

Hello to all,

I have to calculate equations for different locations, where the equations are the same but the variable entry data will change per locations.

I would like to export the data per each calculation file to a master file where I can put them together in just one graph.

Is there any way to do this?

thank you in advance,

Rogelio

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Rogelio.

You can reference your worksheets from one other, the 'main' one.

Check the attached.

Best regards.

Alvaro.

ref.gif

View solution in original post

10 REPLIES 10

Hi Rogelio.

You can reference your worksheets from one other, the 'main' one.

Check the attached.

Best regards.

Alvaro.

ref.gif

You may reference your calculation sheet several times, feeding it every time with different input values, similar to what Alvaro has shown. If only the input values differ, it would not be necessary to create a separate sheet for every calculation.

Another way would be to turn the calculation into a function but this, being a long standing wish (among a lot of others) of the user community, is a feature which is still not implemented and possibly never will.

So a cumbersome option could be that you turn all your calculations into functions depending on your input values.

As an example, instead of writing

you would create functions like this

The drawback is, that if your calculation sheet is fairly large and complex, this can be a lot of work and the sheet could look much more cluttered and unclear.

Werner

rdelascasas
6-Contributor
(To:Werner_E)

It seems that the respond options here does not allow me to say that both answers are correct.

but both answers are correct on this matter.

Thank you very much to both respondents,

the job is now much easier.

Best regards,

Rogelio

The procedure provided above did work when the functions have only one variable.

If the function has more one variable, i have not being able to do it.

any advice?

As can be seen in the case below, i used several references and they worked well, i was able to obtain the graph with all the current sources.

In the case below, i did not run with the same luck, being the functions of two variables, the use of the reference command did not go as expected.

But i do not know what i am doing wrong.

Thank you in advance.

Rogelio

Hard to say w/o the sheet.

Whats the error message at Ens1(y,n) ?

Is Ens1 defined as a function with two arguments in your referenced file?

Obviously you are using units in your calculations - could it be a unit mismatch? Is the result of all summed up functions in Volt?

What do you get when you evaluate Ens2(xin2,n) and Ens1(xin2,n) in your main sheet?

n seems to be a range, not a vector. What is xin2 ? Have you defined y? A range or as vector?

rdelascasas
6-Contributor
(To:Werner_E)

WE,

the responses are below with your questions, to facilitate the understanding.

Whats the error message at Ens1(y,n) ? "This variable is undefined"

Is Ens1 defined as a function with two arguments in your referenced file? Yes, the first argument varies in integer numbers, the second argument numbers the same calculation for three different sources of data. In this case, what I am calculating is the cathodic protection potential to remote earth of three different pipelines in the same right of way.

Obviously you are using units in your calculations - could it be a unit mismatch? Is the result of all summed up functions in Volt? Yes, all the results are in volt in the original calculation sheets.

What do you get when you evaluate Ens2(xin2,n) and Ens1(xin2,n) in your main sheet? In the main sheet, which is the one that includes the calculations for Ens2, I can obtain Ens2 with no problems. Ens1 is the one that I am importing from other calculation sheet. Ens1 is ok in its original calculation sheet.

n seems to be a range, not a vector. What is xin2 ? Have you defined y? A range or as vector? It is a range that runs in the number of underground pipelines in the right of way (ROW)


Thank you in advance,


Rogelio

Hola Rogelio.

Maybe the referenced file work well as isolated file, but when you insert it as reference, the variables defined in the main worksheet are defined at the runtime when the reference is evaluated.

This can cause issues for some calculations, which requires unevaluated names, like some symbolics evaluations, or with recurrent definitions. Also, for some vector calculations, it's a trouble if it is defined previously in some particular way.

As debugging technique, for see if the defined variables in the main worksheet affect the referenced one, you can copy the entire referenced worksheet and paste it (maybe in a collapsable area, you can add lines before pasting).

Then you can inspect if Ens1 is in red in the main worksheet.

Another way, maybe better, is insert as reference the main worksheet in the file where Ens1 is calculated, and see if that affect the calculus of Ens1.

Finally, if you can't post your files, we understand. But please, let us know if they are published.

Best regards.

Alvaro.

thank you Alvaro,

That could be the issue, the files on the first example, where everything works ok, i had all the variables per each of the references, named differently, for example i have Esn1, Esn2, Esn3, and so forth, and the variables that feed the potential value Esn1, etc, are also named with numbers to differentiate them. Because first, before i asked in the community, i was copying the calculation sheets all on the same file, and i had to have the variables named differently to avoid errors in the variable calculations.

that could be the case. i will try your advises to see what happens.

thanks,

Rogelio

Alvaro,

You were right,

i have always to keep variable definitions specified per each calculation sheet, otherwise it creates confusion, as you said,

please, see results below.

I really appreciate all the help received, from all of you,

Regards,

Rogelio

Top Tags