delila - I think that you can just switch/swap the data from each axes before you load the newest image into axes1. For example, suppose that in your GUI's OpeningFcn you default all of the axes data to a blank image like
defaultImg = uint8(zeros(400,400));
imshow(defaultImg,'Parent',handles.axes1);
imshow(defaultImg,'Parent',handles.axes2);
imshow(defaultImg,'Parent',handles.axes3);
imshow(defaultImg,'Parent',handles.axes4);
Now each of these axes has something that we can swap amongst each other. Now in your code that gets the next image, do something like
[filename, foldername] = uigetfile({'*.*'}, 'Select file');
if filename ~= 0
FileName = fullfile(foldername, filename);
img = imread(FileName);
cdata = get(get(handles.axes3,'Children'),'CData');
set(get(handles.axes4,'Children'),'CData',cdata);
axis(handles.axes4,'tight');
cdata = get(get(handles.axes2,'Children'),'CData');
set(get(handles.axes3,'Children'),'CData',cdata);
axis(handles.axes3,'tight');
cdata = get(get(handles.axes1,'Children'),'CData');
set(get(handles.axes2,'Children'),'CData',cdata);
axis(handles.axes2,'tight');
set(get(handles.axes1,'Children'),'CData',img);
axis(handles.axes1,'tight');
end
In the above, we assume that each axes has exactly one child, and that that child corresponds to an image. We then take that image data (from the property CData) and copy it into the CData of the child graphics object in the subsequent axes (so that in 2 moves to 3, that in 3 moves to 4, etc.). We use the
axis(handles.axes4,'tight');
so that the our image fits into the axes (and so the latter doesn't try to re-adjust for images with different dimensions).
Best Answer