Generating sequential wave names
Emat
Wed, 03/14/2012 - 09:16 am
This is probably a pretty simple issue, but I've not programmed much in Igor. I need to make a series of waves that have the same name with a nummerical index that increases by 1 with each new wave (wave1, wave2, wave3 etc). I tried the code below, but it won't compile with the "i" following the wavename in the make command. If I leave the "i" out, then it compiles and runs, but I get an error after the first iteration because the name already exists (duh!). I've been reading the Igor manual on Strings all day.... Help!
variable i
String name = "Diff"+nameofwave(Length)
Do
make $name+i
i += 1
while (i<=100)
$
operator, but you can ignore that). Instead you can try the following:Do
name = "Diff"+nameofwave(Length) + num2istr(i)
make $name
i += 1
while (i<=100)
Note that I would typically use a
for
loop for this.March 14, 2012 at 09:43 am - Permalink
March 14, 2012 at 10:37 am - Permalink