MATLAB: How Can i use in one image only for this code? because it is used in two images

image processing

global image1,image2
im1cand2=bitand(image1,image2);
axes(handles.axes3); imshow(im1cand2);
global image1,image2
im1cxor2=bitxor(image1,image2);
axes(handles.axes3); imshow(im1cxor2);
global image1,image2
im1cor2=bitor(image1,image2);
axes(handles.axes3); imshow(im1cor2);
have button.. first select image 1 second selecte image 2 and then button for im1 cand 2 im1 cxor im2 im1 cor im2.. i dont want to make the act between 2 image but one..

Best Answer

global image12
image12 = {image1, image2};
then later
global image12
im1cand2 = bitand(image12{1}, image12{2});
and so on.