Making new waves
Stosh
Function GW(Int, j)
wave Int//This is the intensity wave. I want to mimic its length
variable j//this is the number of waves I want to generate
wavestats Int//I do wavestats to determine the number of points in the int wave
variable i//This is the loop variable
i = 0
do//loop declaration
i+=1//increment the loop variable by 1
make/c/n=(V_npnts) func//make a wave called function that has the same number of points as the int wave.
while (i < j)
end
How do I make the funt wave have the following names for j = 3. Funt1, Funt2, Funt3?
wave Int //This is the intensity wave. I want to mimic its length
variable numWaves //this is the number of waves I want to generate
variable i //This is the loop variable
i = 0
for (i = 0; i < numWaves; i += 1) //loop declaration
Duplicate/O Int, $("func"+num2str(i)) //make a wave called function that has the same number of points as the int wave.
endfor
end
As a matter of style, its bad form to call in input parameter "j". All variables, especially input parameters, should be named descriptively. It makes it much easier to read the code months later when you've forgotten why you wrote it in a particular way.
The key here is the $ operator that takes a string expression and tells Igor that the string contains a name.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 4, 2013 at 11:20 am - Permalink