MATLAB: How to mean all array

mean

Hi, im using matlab r2018a
lets say i have array
A = [NaN 1 1; 2 NaN 2; 1 NaN 2; 4 2 2]
how to get mean of all of it?
i need the result is 1.888889
i try using
z = mean(A(:))
but the answer is
z = NaN

Best Answer

A = [0 1 1; 2 3 2; 1 3 2; 4 2 2] ;
iwant = mean(A(:))
iwant = 1.9167