MATLAB: How to retrieve image from axes1 and then load it into another axes by using pushbutton.

axesload image

im having two push buttons and two axes. when i press 1st button the selected image will be displayed on axes1 its fine.now how can i do on 2nd button press to show image on 2nd axes.
% code

endfunction pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global filename
[filename, pathname] = uigetfile('','Select Image');
axes(handles.axes1);
input=imread(fullfile(pathname, filename));
imshow(input);
function pushbutton2_Callback(hObject, eventdata, handles)
% code

Best Answer

You can try this:
image1 = get(handles.axes1, 'CData');
imshow(image1, 'Parent', handles.axes2);
Related Question