I am trying to assign random values to the elements of a rectangular region within an image matrix, so that the result looks something like this:
This is my approach:
I = zeros(128,128);for i=32:96 for j=32:96 I(i,j) = rand(); endendimshow(I);
Is there a more efficient way of doing this, perhaps without a double for-loop?
Any suggestions would be greatly appreciated.
Best Answer