Referring to blank cells in function
chemgoof
Kind of like
IF wave0(2) = a number
THEN just copy the number into wave1(2)
IF wave0(2) is a blank cell
THEN take the average of wave0(1) and wave0(3) and insert it into wave1(2)
is you imported the data into a numerical wave a missing value would be assigned NaN (not a Number). You cannot directly test for that condition because by definition comparing anything to NaN returns false. You can use numtype(num) though where a NaN returns a 2
wave0 = numtype(wave0[p])==2? (wave0[p-1]+wave0[p+1])/2 : wave0
result = test condition? true action : false action
The problem you will have is if you have a missing value at either the first or last point in the wave0 because either the [p-1] or the [p+1] will be out of the indexing range. You can wrap a test for the first and last point separately.
August 15, 2013 at 04:34 pm - Permalink
August 15, 2013 at 05:28 pm - Permalink