MATLAB: Composing matrix from small matrices

arraymatrix

Hi all,
I have a random matrix generated by a rand function. The matrix size is 60×60 (a small array). I want to resize this matrix up to 600 x 600 (let's call it big array). I want that every 10×10 pixels from the 'big array' was filled by a corresponding pixel from a small array. For example pixels (1:10, 1:10) from a big array would have a '1' if the small_array(1,1) equals '1'.
How to do that? I tried to treat this array as an image and use imresize funtion, but it gives blurred image. I also tried following code, but there is something missing and I dont know what it is exactly.
size = 60;
Phi = rand(size,size)>0.5;
BigPhi = zeros(600,600);
for i=1:60
n=(i-1)*10
i
if i==1
BigPhi(i:(i*10),i:(i*10))=Phi(i,i);
end;
if i>1
BigPhi((i-1)*10:(i*10),(i-1)*10:(i*10))=Phi(i,i);
end
end
I will appreciate any help.

Best Answer

One line of code:
BigPhi = imresize(Phi, [600 600], 'nearest');
By the way don't do this:
size = 60;
By doing so, you just blew away the very useful built in size() function!!!