The value of this submission is limited to the fact that it demonstrates how NOT to do something in MATLAB. This submission does NOT use MATLABs inherent array capabilities. Two sets of nested FOR loops are Two too many. I encourage the author to remove this file.
I can“t comment on the usefulness of this, but the code alone justifies this rating...
No preallocation, unnecessary for-loops...
The one-liner
BIG=[reshape(repmat([reshape(repmat(IM,2,1),size(IM,1),[])]',2,1),2*size(IM,2),[])]';
speeds this up by a factor of roughly 530 on my machine...