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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

mathcad user defined Variables

Snowshoeman
12-Amethyst

mathcad user defined Variables

I'm using the "include" function to bring in variable values into work sheet.  I would like to bring in variables from a second work sheet.  I'm not always interested in the values of those variables but the expression in the worksheet that defines the variables.  Problem is that the variables are from a set template but the sheet maybe from a different project.

 

Is there a way to concatenate or suffix the variables from the second sheet within the sheet where the include function is used separately of each sheet?

 

As an example, Z1MP from sheet one could be defined as 85%*Z1L or a number with units.

Z1MP from the second sheet may or may not be defined the same.  So I would like to bring in the value or better yet, the explicit expression and rename Z1MP from the second sheet as say Z1MP2..   Maybe explicit representation of the second sheet is reaching too high and I have to settle for the numerical value of Z1MP2

 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Snowshoeman)

The 'include' facility is handling the included worksheet as if it would be part of the current sheet, as if the expressions in the sheet would have been typed in right at the position of the 'include' statement.

So the definition of Z1MP in the sheet referenced last would overwrite the definition of the variable with the same name in the first included sheet.

 

You could try to save the variables to variables of different names right after the 'include' and before the second 'include':

 

include "sheet1.mcdx"

Z1MP_sheet1 := Z1MP

 

include "sheet1.mcdx"

Z1MP_sheet2 := Z1MP

 

To show the formula used to create those variables you still can use the "explicit" modifier but you have to specify both variable names, Z1MP_sheetx and Z1MP. 

 

Example:

Werner_E_0-1751941407207.png

 

View solution in original post

2 REPLIES 2
Werner_E
25-Diamond I
(To:Snowshoeman)

The 'include' facility is handling the included worksheet as if it would be part of the current sheet, as if the expressions in the sheet would have been typed in right at the position of the 'include' statement.

So the definition of Z1MP in the sheet referenced last would overwrite the definition of the variable with the same name in the first included sheet.

 

You could try to save the variables to variables of different names right after the 'include' and before the second 'include':

 

include "sheet1.mcdx"

Z1MP_sheet1 := Z1MP

 

include "sheet1.mcdx"

Z1MP_sheet2 := Z1MP

 

To show the formula used to create those variables you still can use the "explicit" modifier but you have to specify both variable names, Z1MP_sheetx and Z1MP. 

 

Example:

Werner_E_0-1751941407207.png

 

Thank You!  Great idea!

 

Announcements

Top Tags