how to display multiple images and view them one after another in one axes

5 次查看(过去 30 天)
i have a sample gui in which i want to show multiple images in axes. and i want to view them like a slide show with two pushbuttons next and back heres my code for two buttons.this code makes an index of images.
function Backbutton_Callback(hObject, eventdata, handles)
% hObject handle to Backbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles.output = hObject;
handles.index = handles.index - 1;
guidata(hObject, handles);
Cek(hObject, eventdata, handles);
axes(handles.Axes2);
imshow({handles.index},[]);
guidata(hObject, handles);
function Nextbutton_Callback(hObject, eventdata, handles)
% hObject handle to Nextbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles.output = hObject;
handles.index = handles.index + 1;
guidata(hObject, handles);
Cek(hObject, eventdata, handles);
%handles.X(:,:,handles.index)=rgb2gray(imread('Illusion.jpg'));
axes(handles.Axes2);
imshow((handles.index),[]);
guidata(hObject, handles);
function cek(hObject, eventdata, handles)
% axes(handles.Axes2);
% handles.output = hObject;
n = 10;%length(handles.files);
if handles.index > 1, set(handles.Backbutton,'enable','on');
else set(handles.Backbutton,'enable','off'); end
if handles.index < n, set(handles.Nextbutton,'enable','on');
else set(handles.Nextbutton,'enable','off'); end
guidata(hObject, handles);
and this doesnt work when i press nexbutton, image on axes disappears.im really stuck. thanks

回答(1 个)

Dr. Murtaza Ali Khan
The attached code may help someone with the same need. It navigates though sequence of loaded images via Next and Previous push buttons. The code is build using "GUIDE", gui interface builder for MATLAB.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by