Simple way to add waves together
Samuel_S
I must admit I am somewhat new in using IGOR, and haven't figured out all its strengths yet.
My problem is the following:
I have a large set of waves, 480 to be more precise, and I would like to add them (or a subset of them) together in a simple way.
That is, I want the first data point in wave0 to be added to the first point of wave1 and the second data points added together etc. These waves are number from 0 to 479 and have a total of 640 data points.
I tried to simply use the command window to write (after making a new 640 point empty wave called waveX): "waveX = wave0" follwed by "waveX = waveX + wave1" etc up to wave479. It seemed to work, but it took forever. Also, using this strategy it is very bothersome to change the number of waves to be added together, such as if I want to limit myself to wave200 - wave300 or something similar.
Does anyone have an idea how to do this in a fast and easy way?
Thank you in advance!
Samuel
String sList = WaveList("*", ";", "")
Variable vNum = ItemsInList(sList), i = 0
Make /O/N=640 waveX
waveX = $StringFromList(i, sList)
i = 1
do
waveX += $StringFromList(i, sList)
i += 1
while(i < vNum)
end
September 11, 2017 at 03:11 am - Permalink
MatrixOP/O WaveX = sumrows(M_AllWaves)
September 11, 2017 at 04:15 am - Permalink
I am a bit unsure of what the following line means:
WaveList("*", ";", "")
More precisely, what sort of text I should put in it. The wave folder has more waves in it than I want to sum together. Every "wavename" so to speak comes with waves, one for energy and one for intensity. So Ene_[wavename]0 and Int_[wavename]0.
Does that mean I should put something into the WaveList command?
September 11, 2017 at 04:41 am - Permalink
from the command line you'll get examples how the WaveList command works. If you want to sum up the intensities, you would use:
Just be careful that there are no waves starting with "Int_" that you don't want to include in the sum.
September 11, 2017 at 05:26 am - Permalink
September 11, 2017 at 07:27 am - Permalink