If you're using IPT imtile() or montage(), you can maintain the geometry of each sub-image by making sure the 'thumbnailsize' option is large enough to contain any of the included images.
A = imread('peppers.png');
maxv = max(cellfun(@(x) size(x,1),C));
maxh = max(cellfun(@(x) size(x,2),C));
montage({A B},'thumbnailsize',[maxv maxh])
Bear in mind that this forces each sub-image to be padded horizontally and/or vertically to match the same geometry. If you're expecting to be able to have the images to only be padded along one dimension and edge-concatenated along the other, then IPT imtile()/montage() won't work afaik.
One option is to simply pad the images along the transverse dimension and then just concatenate them. This is simple and should work so long as all the images share the same depth (same size on dim3) and class. This example could be written to concatenate vertically as well.
A = imread('peppers.png');
maxsize = max(cellfun(@(x) size(x,1),C));
padsize = (maxsize - size(C{kimg},1))/2;
C{kimg} = padarray(C{kimg},[floor(padsize) 0],0,'pre');
C{kimg} = padarray(C{kimg},[ceil(padsize) 0],0,'post');
There are also third party tools that can do this sort of flexible edge-stacking. MIMT imstacker() could be used, and may be more convenient. That said, it might be too expensive to use with such large images. Because imstacker() is meant to be class-agnostic, the output and intermediate working images will be of class 'double'. That sort of memory usage will likely be a problem for your particular needs. A = imread('peppers.png');
outpict = imstacker(C,'dim',2,'padding',0,'gravity','center');
outpict = imstacker(C,'dim',1,'padding',0,'gravity','center');