for example, given matrix A:
A=[2 0 3 -1 6; -1 -2 3 5 0; 2 3 4 -1 7; 5 1 0 0 4; 0 1 5 0 -2];
I want to obtain this:
A=[2 2.5 3 -1 6; -1 -2 3 5 4; 2 3 4 -1 7; 5 1 2.5 2.5 4; 3 1 5 1.5 -2]
if zero element hasn't previous elements I want the mean between the two following elements
if zero element hasn't following elements I want the mean between the two previous elements
thanks
Best Answer