MATLAB: Number of elements

element

I have an array A(1483 rows, 417 columns) with integer values of 1 to 5. I want to know whithin each block 92*92(i:i+91,j:j+91), what is the percentage of each value. I looked at size(), hist(), numel() but I don't think they can do what I want. Could you please help me?

Best Answer

M = A(i:i+91,j:j+91);
h = histc(M(:), 1:5);
p = h ./ (92*92) * 100;