필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
nida
nida 2014년 4월 21일
답변: Dr. Murtaza Ali Khan 2018년 6월 19일
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
Dr. Murtaza Ali Khan 2018년 6월 19일
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