If I have a vector of #'s and zeroes
ex. z=[ 0 0 0 2 3 4 0 0 0 0 0 6 7 8 0 0 0 13 18 22]
and I want to replace the numbers that are together that are not equal to 0 with the mean value of those set of numbers to give.
ex. z = [ 0 0 0 3 3 3 0 0 0 0 0 7 7 7 0 0 0 17.66 17.66 17.66]
How do I do this?
Best Answer