Is there an easy way to tell if a variable or function has been defined.
Is there an easy way to tell if a variable or function has been defined.
(OP)
I am a long time Mathcad and C programmer. In C one includes header files. Since many header files are often included, it is possible that a variable or function has been defined before so there is a test to see if the variable has been defined before, so it doesn't get redefined.
In Mathcad I often use the ability to include other mathcad files. What I need is a way to test if a variable has been defined before so it is not redefined
In short, Mathcad has no
#ifdef
#endif
feature like C or C++ have that I can see.
I have been using Mathcad since Mathcad 3 or about 30 years.
I am shocked that I haven't noticed this before.
I have about 1000+ Mathcad files and was starting to "clean them up" when I came across this problem. So many have Bode plots with common code or Pole Zero plots that are the same with only the variables being different.
In Mathcad I often use the ability to include other mathcad files. What I need is a way to test if a variable has been defined before so it is not redefined
In short, Mathcad has no
#ifdef
#endif
feature like C or C++ have that I can see.
I have been using Mathcad since Mathcad 3 or about 30 years.
I am shocked that I haven't noticed this before.
I have about 1000+ Mathcad files and was starting to "clean them up" when I came across this problem. So many have Bode plots with common code or Pole Zero plots that are the same with only the variables being different.
Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com
http://forum.deltamotion.com/
IFPS Hall of Fame Member
RE: Is there an easy way to tell if a variable or function has been defined.
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Is there an easy way to tell if a variable or function has been defined.
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: Is there an easy way to tell if a variable or function has been defined.
Insofar as most variables are defined on the main worksheet; functions and programs have locally scoped variables, but can use global variables.
Global variables in sheets that are referenced become global variables of the referencing sheet, hence the need for a way to check if the variable defined on a referenced sheet.
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Is there an easy way to tell if a variable or function has been defined.
-----*****-----
So strange to see the singularity approaching while the entire planet is rapidly turning into a hellscape. -John Coates
-Dik
RE: Is there an easy way to tell if a variable or function has been defined.
RE: Is there an easy way to tell if a variable or function has been defined.
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Is there an easy way to tell if a variable or function has been defined.
In essence I'm using programming technique I was taught in college - be sure to initialize before and clean up after blocks of code.
During the checking process I can open each collapsed area and see if the values make sense.
RE: Is there an easy way to tell if a variable or function has been defined.
The problem is that I must always manually define or undefine variables in the included/inner/child work sheet. I think the only solution is to NEVER define the variables in the included worksheet but have a test outer worksheet that defines varuables for testing the inner worksheet.
This way the inner worksheet never defines variables that override the outer worksheet's variables.
I just thought I would post my kludge solution. Frustrating.
For all its flaws. I still like using Mathcad for making YouTube videos. I have the whole worksheet tested and blow it up to 150% to 200% for the video. This way I don't waste time crating things on video like the professors do. This wastes time. The Mathcad worksheet is used as an outline too.
Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com
http://forum.deltamotion.com/
IFPS Hall of Fame Member
RE: Is there an easy way to tell if a variable or function has been defined.
-----*****-----
So strange to see the singularity approaching while the entire planet is rapidly turning into a hellscape. -John Coates
-Dik