making random images in matlab

Image is set of pixels, and if we have to make an image which has some consistent pixels values, we can make it by using simple matlab loops.


function y = dummyFunction() 
for i = 1:200 % height of the image
    for j = 1:200 % width of the image
        A(i,j) = 0.5; % display range will be 0 to 1 (any floating number)
imwrite(A,'img1.jpg','jpg') % writing array to disk as image

Call this function from matlab as :

>> dummyFunction()

Output :