Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reddefining a Variable

Status
Not open for further replies.

mohammed43

Civil/Environmental
May 5, 2012
49
Hello,

can we redfine a variable that is previously defined. I have a situation where the varialble value need to be modified under certain conditions
Fy=35
Fy=2CEt/d if D/t > 60
Fy=XXXx if(XXXXX)

Please see the attached file..

Thanks for your help..
 
 http://files.engineering.com/getfile.aspx?folder=f68d96e1-643c-45f2-88aa-07eceb96a0c1&file=Tubular_memberDesign.xmcd
Replies continue below

Recommended for you

Sure you can redefine any variable as often as you like. To the right and below that new definition the new value is used.

Not sure what we are supposed to see in the file you posted and what the problem there should be?
 
Seems to me that you can write all of that as a single IF statement:
TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
Iam trying to redefine Fy in the attached worksheet. I tried checking the the Fy vlaue but it doesnt display anything..
It under allowable stresses.. Its after **************** lines

Thanks

 
Did you look at my file

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
First let me say that IMHO its a very bad habit to put all calculations of a whole worksheet into one text region - not flexible, hard to edit, hard to debug and no benefit, unless you want to put two independent text regions side by side which should not interact.

Second I don't see any of your attempts in that sheet where you would try to evaluate Fy and which are not displaying anything (maybe pressing F9 helps), as you wrote!?? So whats the the problem and where??? When I evaluate Fy before your redefinition I get 35ksi, if I do it afterwards I get 34.235ksi, so obviously the redefinition works.
The definition of Fy at the top (35ksi) seems to be obsolete anyway as you never use it and later Fy is calculated and the initial value overwritten (by 34.235ksi).
 
The first IF statement maintains Fy if D/t is less than ...

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
Just saw that indeed you use the initial value of Fy in the redefinition of that variable itself - so the initial assignment is not obsolete.
 
For some reaon it was not displaying the value of Fy after redefining the variable.
I was been told by my senior (who initiated me to use MATHCAD)that its always good to write in one text block so that its easy to copy paste in report or create reports. and everything lines up perfectly..

I would like to know the prefreed way or how most people do it....

Thanks
 
So I assume its working now for you?

If copying and pasting a bunch of associated regions is needed I would put them in an area, collapse it and then its easy copied as a hole and transferred to another sheet.

To sew how other works you may just scan this forum, or even better the main Mathcad Community forum at PTC and look what others do. Chances are you won't find a s single sheet where all calcs would be placed inside a single text region. But you sure have to find your own prefered way of doing things. Try both, compare and judge yourself. Looking at Mathcad as a line oriented word processing tool might have some advantage concerning lining up of regions because you don't have much choice to arrange things, which in effect is a drawback of that approach, too. Looking at Mathcad as a mathematical scratchpad seems the more appropriate view in my opinion and its also the view the creator of Mathcad, Allen Razdow, had in mind. Of course using is as a scratchpad, a litte more work and discipline may be necessary to get everything lined up perfectly. Alignment tools, rulers, tabulators and tabulator guidelines help you doing so and I guess at the end you profit by a better workflow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor