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

Overwrite variabel from reference file?

ptc-4255497
1-Newbie

Overwrite variabel from reference file?

Hello

Im writing my master thesis and the idea is to have a reference file for all functions

sadly if i do not write out the variabels before the function, i need to "call them" in the function name

ending up with a function with 20 variables such as

func(a,b,c,d,e,f,g, etc etc) and the function will not fit in a printable area

My idea is therefor

to put all values equal to 0 in the reference file and then rewrite the values when the reference file is used

sadly i fail to do so since the values from the reference files are used even when I rewrite them.

The idea is that i want to do something like this, and in the "regular file" get the value 2 instead of 0

question.png

I know this is a bad function but its used only to demonstrate my problem. Is there any way to rewrite the values from the reference file?

Or do i really have to end up with a function in reference file as "func(a,b)=..."

Appreciate your help since this is the last step left in my master thesis and all the programming is done properly

Im using Mathcad 15

1 ACCEPTED SOLUTION

Accepted Solutions

This would work, but since my reference file is according to Eurocode, id like to keep the variable names

i just found a solution similiar to yours, my next question is

id like to put the variable L to define "length" in the reference file

but its already redefined as a built in variable.

Is there a way to delete the pre-defined value in the reference file, else i could just change the font that seemed to work.

simple i want to delete this pre-built L

deletethis.png

View solution in original post

7 REPLIES 7

You could put all your variables into a vector, v:=(a, b, ... etc) and then pass the vector name, v to the function.

e.g.

refparams.PNG

However, if your parameters had different units you would need to remove the units for purposes of creating the vector as M15 doesn't like mixed units in a vector.

Alan

This would work, but since my reference file is according to Eurocode, id like to keep the variable names

i just found a solution similiar to yours, my next question is

id like to put the variable L to define "length" in the reference file

but its already redefined as a built in variable.

Is there a way to delete the pre-defined value in the reference file, else i could just change the font that seemed to work.

simple i want to delete this pre-built L

deletethis.png

Jafar Al-Djaber wrote:

This would work, but since my reference file is according to Eurocode, id like to keep the variable names

i just found a solution similiar to yours, my next question is

id like to put the variable L to define "length" in the reference file

but its already redefined as a built in variable.

Is there a way to delete the pre-defined value in the reference file, else i could just change the font that seemed to work.

L is used for the unit liter in Mathcad. As soon as you define your own variable L the liter are gone. You can tell MC not to moan abou the redefinition by the green wavy underline in the options.

Oki thanks guys for the super fast replies. You saved my day.

Here is what i came up with (whoever might find this intresting)

You can overwrite the built in L if you define it in your programming file BEFORE (rows above) inserting the reference file.

so having a function like this F(X)=a+b+c

without defining a b c will yield an error in the reference file

but if you state a, b ,c in your programming file before inserting the reference file it will calculate the function properly

The problem you may face is a lot of errors in the reference file, that makes it harder for you to program, there fore start with defining all variables you need. do the programming in the reference file, and in last step simpley delete them.

Thanks again guys.

Reference file (here L is defined as a volume unit as pre-build)

reference+file.png

Working script

working.png

not working script

not+working.png

It was a silly solution, for a silly question.

Jafar Al-Djaber wrote:

Oki thanks guys for the super fast replies. You saved my day.

Here is what i came up with (whoever might find this intresting)

You can overwrite the built in L if you define it in your programming file BEFORE (rows above) inserting the reference file.

so having a function like this F(X)=a+b+c

without defining a b c will yield an error in the reference file

but if you state a, b ,c in your programming file before inserting the reference file it will calculate the function properly

The problem you may face is a lot of errors in the reference file, that makes it harder for you to program, there fore start with defining all variables you need. do the programming in the reference file, and in last step simpley delete them.

You may consider instead of using a referenced file to put the function definition in a collapsed area. Its out of the way as well and you have do deal with one file only.

Thanks my issue is that i will end up with 20 worksheets and if i use a collapsed area, I need to modify the functions in 20 places in the future if needed. Sorry my bad, should have explained my issue better. Appreciate your help

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."