I have a 16X16 matrix. I have to add it to a 256X256 matrix. Can anyone help me how to make this 16X16 matrix into 256X256 filling the remaining with zeros?
So, this doesn't actually answer your question, but I think it answers the use case you gave. Assuming you want to add the smaller matrix to the upper-left corner of the big matrix:
big = ones(256, 256);
small = ones(16, 16);
big(1:16, 1:16) = big(1:16, 1:16) + small;
This avoids allocating an extra 65000 or so doubles which you would have to do if you re-sized small from 16x16 to 256x256.