フィルターのクリア

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 Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by