GUi to wait for events from one of two push buttons

조회 수: 2 (최근 30일)
divya r
divya r 2014년 4월 3일
댓글: Dishant Arora 2014년 4월 4일
Hi
I have designed a GUI which is taking some images iteratively from a folder and displays it. I have two push buttons "Save" and "Dont Save" which either save(or not) some information about the data.
Since I am reading the data iteratively, all the images are displayed continuously without waiting for a response from the user. I want the GUI to wait for a event to occur in one of the two push buttons and to perform the respective action.

채택된 답변

Dishant Arora
Dishant Arora 2014년 4월 3일
편집: Dishant Arora 2014년 4월 3일
You can store file names in the handles structure and do something like this:
function gui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.Counter = 1;
guidata(hObject , handles);
updateCounter(hObject, handles);
function pushbutton1_callback(hObject, eventdata, handles)
updateCounter(hObject, handles);
function updateCounter(hObject, handles)
% Your code to read , display and write image.
handles.Counter = handles.Counter+1;
guidata(hObject, handles)
  댓글 수: 2
divya r
divya r 2014년 4월 4일
How do I check which of the two push buttons have been pushed? If "Save" has been pushed, the data should be saved else not.
Dishant Arora
Dishant Arora 2014년 4월 4일
function updateCounter(hObject, handles)
if ~get(handles.dontSavePushButton , 'Value')
% Your code to read , display and write image.
end
handles.Counter = handles.Counter+1;
guidata(hObject, handles)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by