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!
variableiString name = "Diff"+nameofwave(Length)Domake$name+ii += 1while(i<=100)
The error occurs because Igor cannot add a number to a string (name + i) (actually which error gets thrown depends on the precedence of the $ operator, but you can ignore that). Instead you can try the following:
variablei = 0Do
name = "Diff"+nameofwave(Length) + num2istr(i)make$namei += 1while(i<=100)
Note that I would typically use a for loop for this.
$
operator, but you can ignore that). Instead you can try the following: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