필터 지우기
필터 지우기

Using uiwait with wrndlg with modal property in a guide callback of a slider throws the code into chaos

조회 수: 1 (최근 30일)
Hello, In the callback of my slider which I created using guide, I want to insert a warndlg once a particular value has exceeded. I want to stop interaction with the main figure till the wrndlg box has been acknolwedged. I do so as: call a function which gives me an errorvalue 1 or 0 is the limit has exceeded.
function sliderElec1_Callback(hObject, eventdata, handles)
% hObject handle to sliderElec1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
[errorValue,errorMsg] = checkStimulationPara(hObject,handles);
if errorValue
uiwait(warndlg(errorMsg, 'Warning', 'modal'));
fid = fopen(handles.errorFileName,'at');
fprintf(fid,[datestr(now,'yymmdd') ' ' datestr(now,'HHMM'),': ']);
fprintf(fid,['checkStimulationfn', '', errorMsg,'\n']);
fclose(fid);
end
now, when i slide the slider across the set value for eg: 30, the dlg box goes crazy, opens and closes multiple times and goes into an infinte loop by increasing the slider value.
Any help will be greatly appreciated!
  댓글 수: 14
Adam
Adam 2018년 8월 15일
If you are using a standard Matlab slider with a release callback rather than a continuous callback then it probably shouldn't cause problems, but it is something I always avoid doing as it is easy to create problems for yourself by 'pulling the rug out from under your feet'
Darshan Shah
Darshan Shah 2018년 8월 15일
I had no idea there were these variations! Thank you for pointing it out!

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

답변 (0개)

카테고리

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