MatrixOP mean operation returns NaN

Hello,

I'm writing a procedure that operates a 2D Wiener filter on some of my images.

In the procedure I'm using the following equation:


MatrixOP/O ww=mm+(sig2-mean(sig2))/sig2*(I-mm)


In this expression
mean(sig2)
returns a NaN.

Any suggestions?