
Averaging waves which has NaN for some rows

Jinhyung Kim
I need help.
I want to average waves which has NaN for some rows.
However, if i use the code "WavesAverage Example" in the Igor manual,
the destination wave also has NaN in the same rows.
Can I average waves ignoring the NaN rows ?
For example, please see the attached image, I want to make the averagedWave which is calculated average by ignoring the NaN rows.
I'm using Igor Pro 6.37 on Mac.
Please advise me.
Thanks in advance.

MatrixOP ReplaceNaNs(w, replacementVal)
to replace NaN values, but that is not what you want. I think you have to write your own procedure for it, along the lines of what I did below:September 25, 2017 at 03:35 am - Permalink
If you are attempting to average across multiple waves on a point by point basis, this could be done with a loop creating a new wave from the points of the source waves and then doing a wavetransform with overwrite. Then do a mean(wavename).
Andy
September 25, 2017 at 08:33 am - Permalink
From Igor's Analysis menu, choose Packages->Average Waves
Select the waves you want to average and click Do It.
NaNs will be accounted for. For example, if averaging 3 waves but only 2 have non-NaN values, the divisor of the average will be 2, not 3.
Pretty straightforward.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 25, 2017 at 09:13 am - Permalink