# MATLAB: Sum the matrix 3×3 and looping

convolutionImage Processing Toolboximfilter

how to calculate the total of overlap region 3×3 of a matrix and include loop function as it continue to calculate row by row and column by column.

outputArray = conv2(double(inputArray), ones(3), 'same');