In working through a problem in Igor, I declared a variable (say A1), but then wanted to re-dimension that into a wave with the same name. Is there a way of either deleting a variable or re-dimensioning it into a wave?
In working through a problem in Igor, I declared a variable (say A1), but then wanted to re-dimension that into a wave with the same name. Is there a way of either deleting a variable or re-dimensioning it into a wave?
If it is local to a function, no.
If it is declared global, then KillVariables is likely what you need.
It is not clear to me though from a programming standpoint why you would absolutely need to change a variable to a wave of the same name???? Why not just use a wave of varying length (length = 1 is a variable, otherwise it is a wave)?
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Thanks. It was a local variable. I started out declaring a variable then changed my mind and wanted to use the name as an array. This was not a carefully planned exercise, just exploring data, and I was curious to know if I could remove he variable name. I used a different name for the wave.
I think I know what you're trying to do. In general, waves have global scope and are persistent, unless they are "free" waves. Normally a variable in a function is local and non-persistent, unless you need to reference a global variable (NVAR).
However, you can't make a variable into a wave and vice versa. As far as I can see you're coming from a Python point of view where you can rebind variable names. Thus if your're fed up with a being a tuple, you can rebind it into a string.
If it is local to a function, no.
If it is declared global, then KillVariables is likely what you need.
It is not clear to me though from a programming standpoint why you would absolutely need to change a variable to a wave of the same name???? Why not just use a wave of varying length (length = 1 is a variable, otherwise it is a wave)?
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
December 1, 2010 at 08:46 pm - Permalink
December 1, 2010 at 10:12 pm - Permalink
However, you can't make a variable into a wave and vice versa. As far as I can see you're coming from a Python point of view where you can rebind variable names. Thus if your're fed up with a being a tuple, you can rebind it into a string.
December 2, 2010 at 12:40 am - Permalink