Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Adam
Adam il 15 Ago 2018
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'

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by