MATLAB: How to caculate covariance matrix

image processingmatrix manipulation

i tried to calculate covariance of matrix but an error appeared:
here is my matrix (3*3):
m=
26 197 27 197 28 197
26 196 27 196 28 196
26 195 27 195 28 195
where(26,197) describe piwel's position
and this is the error:
Error using bsxfun
Mixed integer class inputs are not supported.
Error in cov (line 154)
xc = bsxfun(@minus,x,sum(x,1)/m); % Remove mean
Error in fourptm (line 155)
c=cov(m)

Best Answer

cov(double(m))