Multiple Wave Operation
xavsd
I'm trying to make the following arithmetic operation to 1500 waves, using Igor:
DFS_500_0001Defl = (-1)*DFS_500_0001Defl
All of the waves have the same name, except for the number XXXX, ie., DFS_500_XXXXDefl.
Do you know if there's any generic way to apply this operation to 1500 waves, without needing to type 1500 times the operation changing the number of the wave?
Hope you answer to me soon, thanx
xavier
Open up a procedure window (eg. the built in procedure window, which you can get by pressing Ctrl-M) and past the following function into the window:
Function foo()
Variable n
String currentWaveName
Variable numWaves = 1500
For (n=0; n<numWaves; n+=1)
sprintf currentWaveName, "DFS_500_%.4dDefl", n
print currentWaveName
WAVE currentWave = $(currentWaveName)
currentWave = (-1)*currentWave
EndFor
End
Then, from the Igor command window, type:
foo()
and hit enter.
March 17, 2008 at 11:52 am - Permalink
March 18, 2008 at 03:16 am - Permalink
variable n=0
string cWaveName
do
sprintf cWaveName, "DFS_500_%.4dDefl", n
if (exists($cWaveName)!=1)
break
endif
wave cWave = $cWaveName
cWave*=-1
n+=1
while(1)
return 0
end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
March 18, 2008 at 02:52 pm - Permalink