필터 지우기
필터 지우기

save gui handles between uiwait/uiresume calls

조회 수: 3 (최근 30일)
River Rock
River Rock 2015년 5월 18일
댓글: River Rock 2015년 5월 19일
Hi,
I'd like to implement the following behaviour in my gui app: - start iterating through a for loop and compute an array - at the end of each loop, pause and give control to the user, which should be able to manually remove some elements from the array - resume execution
To do it, i write the array to the handles data structure:
handles.data.myArr = myArr;
guidata(hObject,handles);
then call uiwait:
uiwait;
and then update the variable:
myArr = handles.data.myArrTmp;
The callback that creates myArrTmp first gets the initial array from the handles:
myArrTmp = handles.data.myArr;
updates it according to user's choice, then writes it back to the handles
handles.data.myArrTmp = myArrTmp;
guidata(hObject, handles);
and finally calls uiresume:
uiresume;
When the control is returned to the main loop, it seems that the handles are reset, such that after uiwait, handles.data.myArrTmp does not exist.
How can I make the data inside the handles structure persist after calling uiresume? Is there a better method that could implement the same behaviour ?
Thank you.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 19일
The routine needs to call guidata() to retrieve the changed version of the handles structure.
  댓글 수: 1
River Rock
River Rock 2015년 5월 19일
Hi Walter,
Thanks for the reply. I do call guidata, but the handles are lost when uiresume is called.
Does uiwait block the execution of the current (parent) callback or the one of the entire gui app?
I am still able to debug inside the new callback (while uiwait is active).

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

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by