MATLAB: The answer is NaN

for loopglcmgraycomatrixImage Processing Toolboxnan

I don't know why the answer of this code is NaN. Help me please. thanks so much
for a = 01:20
filename = [num2str(a,'%02d') '_training' '.tif'];
img = imread(filename);
img1=imrotate(img,90,'bilinear');
C=rgb2gray(img1);
%co-occurrence matrix
glcm=graycomatrix(C,'GrayLimits',[0 255],'NumLevels',256,'Offset',[-1 -1]);
p=glcm/sum(glcm(:));
entropy=0;
for i=1:256
for j =1:256
entropy=entropy-p(i,j)*log2(p(i,j));
end
end
kq(a,:)=[entropy];
end

Best Answer

What prevents p(i,j) from being 0 in
entropy=entropy-p(i,j)*log2(p(i,j));
Note
>> 0*log(0)
ans =
NaN