use output of one function in another function
mwpro
Fri, 04/14/2017 - 02:32 pm
Hi I was trying to use the output of one function in another function by citing directly the name of the variables/strings in this one function but it seems the external function doesn't recognize the variables/strings I was trying to use. How should I specify a location or properties of the variables in the "internal" function so that it can be accessed from "outside"? Thank you!!
A more simple alternative is to return a variable if that is all you want to do. Alternatively, you can set values in numeric or text waves which can be accessed from outside.
April 14, 2017 at 10:30 pm - Permalink
Depending on your specific task, it might also be worth to have a look at the pass by reference method to access variables (rather than by value):
displayhelptopic "Pass-By-Reference"
Be careful. Lots of traps ahead :-)
HJ
April 15, 2017 at 02:22 am - Permalink
I usually use a string constant in the preamble of the procedure file to set a base data folder
//...
SetDataFolder $MyBaseFolder+"Variables" //example 1
NVar Duration // If 'Duration' is defined in 'root:NAC:Variables'
//...
NVar Amount=$MyBaseFolder+"Experiment:AmountOfDatapoints"//example 2 works form any position
HJ
April 15, 2017 at 02:31 am - Permalink
April 15, 2017 at 12:08 pm - Permalink