MATLAB: Changing a matrix size

matrix manipulation

Hello,
Basically i want to change a logical matrix size from 144×144 to 512×512, here is the case that i have:
i have two images of the same object with those sizes accordingly with some region of interest approximately in the middle of the 144 image here is a small example:
the matrix of the region is as follows:
[0000000000
0001111000
0000110000
0000000000]
the regions are hazardous but in the middle give or take, i have them all. now i want to apply those regions to the bigger image so i need to expande the matrix to go with the 512×512 image. as follows
[000000000000000000000
000000111111110000000
000000001111000000000
000000000000000000000]
any ideas ?
Regards

Best Answer

% A is 144 x 144 input binary matrix
I512 = logical(interp2(...
linspace(0,1,size(A,2)),...
linspace(0,1,size(A,1)),...
double(A),...
linspace(0,1,512),...
linspace(0,1,512)')); % this is the "same" image with size 512 x 512