I can see why this doesn't work, but like your last question, I can't see what you are trying to do. I'm guessing you probably want to do this in a loop?
I think you need to do the Tour and work through Getting Started with Igor Programming. It will be worth it.
I am trying to update specific wave whose name was declared with variable controlled by GUI.
I tried to find out in igor programming.pdf, but I could not find answer for that...
sjr51 wrote:
Hi,
I can see why this doesn't work, but like your last question, I can't see what you are trying to do. I'm guessing you probably want to do this in a loop?
I think you need to do the Tour and work through Getting Started with Igor Programming. It will be worth it.
First, "wavename" is the name of an Igor built-in function, as you can see by the red syntax coloring. We probably shouldn't let you do that :)
Otherwise, everything but the last line seems fine as long as "base" is defined in some way. But the last line is not a proper use of the $ operator if it is in a function. My guess is that the error you refer to was "Can't use $ in this way in a function". It is not very useful in general, to report that "an error occurred". It is much more useful to those trying to help you if you tell us what the error message was.
Thanks for kind explanation.
Since it is the first time to make program with Igor, I am suffering many problems even asking something :)
The problem that i suffer from is what you mentioned. "Cant use $ in this way in a function"
There are some waves whose names are "allignepoint_n", whose n is variable such as 1, 2, 3, 4... etc
I am trying to control the variable n using "popupmenu". I can get some number but I cannot call the wave again using the variable.
The final goal is to update those waves such as "allignpoint_1", "allignpoint_2" after some calculation.
Thank you for kind help in advance.
johnweeks wrote:
First, "wavename" is the name of an Igor built-in function, as you can see by the red syntax coloring. We probably shouldn't let you do that :)
Otherwise, everything but the last line seems fine as long as "base" is defined in some way. But the last line is not a proper use of the $ operator if it is in a function. My guess is that the error you refer to was "Can't use $ in this way in a function". It is not very useful in general, to report that "an error occurred". It is much more useful to those trying to help you if you tell us what the error message was.
Here's how you would refer to the waves you described:
Variable counter = 1// replace this with a way to select your wave number or loop though the numbersString currentName = "allignpoint_" + num2istr(counter)Wave workwave = $currentName// you do not need to change anything here in a loop etc. changing the 'counter' will replace the wave definition
Now you could do operations just by calling 'workwave':
Variable data = 2// replace this with a way to select your data position
workwave[data] = 3
I can see why this doesn't work, but like your last question, I can't see what you are trying to do. I'm guessing you probably want to do this in a loop?
I think you need to do the Tour and work through Getting Started with Igor Programming. It will be worth it.
August 14, 2016 at 10:58 pm - Permalink
I tried to find out in igor programming.pdf, but I could not find answer for that...
August 14, 2016 at 11:38 pm - Permalink
Otherwise, everything but the last line seems fine as long as "base" is defined in some way. But the last line is not a proper use of the $ operator if it is in a function. My guess is that the error you refer to was "Can't use $ in this way in a function". It is not very useful in general, to report that "an error occurred". It is much more useful to those trying to help you if you tell us what the error message was.
What were you trying to achieve with that line?
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
August 15, 2016 at 09:41 am - Permalink
Since it is the first time to make program with Igor, I am suffering many problems even asking something :)
The problem that i suffer from is what you mentioned. "Cant use $ in this way in a function"
There are some waves whose names are "allignepoint_n", whose n is variable such as 1, 2, 3, 4... etc
I am trying to control the variable n using "popupmenu". I can get some number but I cannot call the wave again using the variable.
The final goal is to update those waves such as "allignpoint_1", "allignpoint_2" after some calculation.
Thank you for kind help in advance.
August 16, 2016 at 06:51 am - Permalink
Now you could do operations just by calling 'workwave':
August 18, 2016 at 04:27 am - Permalink