Feedback to the waves whose name expressed with $
linepic
but I cannot solve the error... please help
string a = base
variable b = 3
variable data = 2
string wavename = base + num2str(b)
wave w0 = $wavename
w0[data] = 3
$wavename = w0
variable b = 3
variable data = 2
string wavename = base + num2str(b)
wave w0 = $wavename
w0[data] = 3
$wavename = w0
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
String 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':
workwave[data] = 3
August 18, 2016 at 04:27 am - Permalink