The size of the GCLM matrix (output from the “ graycomatrix ” function) depends on the number of grayscale levels of the image, and not on the size of the image itself. The ‘ numlevels ’ parameter can be modified to adjust the number of grayscale levels used by “graycomatrix” and hence change the size of the output.
In your case, you could try:
>> glcm = graycomatrix(I,'numlevels',256);
Please refer to the following documentation for more information about the “integral2” function: http://www.mathworks.com/help/images/ref/graycomatrix.html