What is the function to calculate RSME of two images in matlab?

i use:

>> I = imread('C:\Users\teymo\Desktop\New folder\CPU\rgray8.bmp');

>> J = imread('C:\Users\teymo\Desktop\New folder\CPU\blur.bmp');

>> pog = sqrt(mean((J-I).^2));

>> message = sprintf('The Root mean square error is %.3f.', pog);

>> msgbox(message);

but i get a error string error computing that, but the message box variable does show the root sqaure but there are more than 1 number ?

"'The Root mean square error is 0.000.The Root mean square error is 2.848.The Root mean square error is 3.040.The Root mean square error is 3.056.The Root mean square error is 3.183.The Root mean square error is 3.350."

It goes on forever so im not sure how to do it correctly

## Best Answer