# how to add two images in one, next to each other

I have two splited images from diference matlab files. Now i need to merge them, near to each other. I tried supblot, imadd,cat methods, but nothing works. Please help me.

rezult after sublot experiment.

combinedImage = [leftImage, rightImage];


Not exactly sure what you want to do.

If you want to put both images into one matrix, then you could do something like:

% just some sample data
img1 = repmat(0:0.01:1,100,1);
img2 = repmat(1:-0.015:0,120,1);

% create new image with enough space next to each other
newImage = zeros(max(size(img1,1),size(img2,1)),size(img1,2)+size(img2,2));
newImage(1:size(img1,1),1:size(img1,2)) = img1;
newImage(1:size(img2,1),size(img1,2) + (1:size(img2,2))) = img2;
% visualize
imshow(newImage)