Local variables by reference?
jslowik
variable var = 5
print func("var")
...would print 5.
I'd like to store the local variables/strings generated by some Igor functions (e.g. wavestats) in a wave, but want the saved outputs to be determined by instructions in a string rather than hardcoded into the function (e.g. the user might pass "V_avg;V_sdev;V_maxloc;" with the intent of generating an output wave holding these values). However, wavestats' output are local rather than global variables, so the $-based reference won't work. Is there a reference system for local variables, or a function like the above that can do this? Many thanks!!
You would have to do something like this:
Wave w
String list // e.g., "V_avg;V_sdev;"
WaveStats/Q w
Make/O/N=3 output = NaN
if (WhichListItem("V_avg",list) >= 0)
output[0] = V_avg
endif
if (WhichListItem("V_sdev",list) >= 0)
output[1] = V_sdev
endif
if (WhichListItem("V_maxloc",list) >= 0)
output[2] = V_maxloc
endif
End
November 7, 2013 at 11:37 am - Permalink