필터 지우기
필터 지우기

Help with Next Button for GUI

조회 수: 2 (최근 30일)
Shiladitya Chatterjee
Shiladitya Chatterjee 2016년 5월 18일
답변: Geoff Hayes 2016년 5월 18일
Hello,
I am new to the GUIDE toolbox. I want to create a pushbutton that will go sequentially through individual plots of a data set. I have loaded the data through a pushbutton and have created a global variable handles.i to index the column that will be plotted. However, in the callback for the NEXT button, handles.i=handles.i+1 does not update the handles.i value and hence I cannot plot the next column of the data set upon pressing the NEXT button again. Please help

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 5월 18일
Shiladitya - when you update a field within the handles structure, you need to call guidata so that this update is "saved" to the structure for subsequent uses of handles. For example, in your next button callback you could do
function nextButton_Callback(hObject, eventdata, handles)
% do something
% update i
handles.i = handles.i + 1;
% save the updated handles structure
guidata(hObject, handles);
The last line is important - it will save the updated structure so that the subsequent call to the above (or any other callback with the handles input) will receive the updated handles object.

추가 답변 (0개)

카테고리

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