Replicating the gaussian noise functionality of imnoise() does not require any loops. If someone insists that you need to use loops, make sure to let them know they're wrong.
inpict = im2double(imread('cameraman.tif'));
outpict = inpict + gaumean + sqrt(gauvar)*randn(s0);
If you want to know how imnoise() does something, open imnoise() and look at $MLROOT/toolbox/images/images/+images/+internal/algimnoise.m