Because you never assigned any number to bins. Try
[~,R] = imnoise2(ones(100000,1),'gaussian',0,1);
bins = 256;
hist(R, bins);
or
[~,R] = imnoise2(ones(100000,1),'gaussian',0,1);
imhist(R);
or
[~,R] = imnoise2(ones(100000,1),'gaussian',0,1);
histogram(R, 256);