user interface - matlab gui togglebutton stop while loop -
i having trouble stopping execution of while-loop activated pressing togglebutton , meant stop when togglebutton "untoggled".
the code inside calls function causes steppermotor connected arduino 1 step. function needs 10ms execute.
stopping works fine if add pause after function call, onestep-function needs longer execute wish , minimum pause-time 10ms solution isn't pleasing.
% --- executes on button press in aplus_button. function aplus_button_callback(hobject, eventdata, handles) while get(hobject,'value') onestep(1, 'motor', handles) % if add pause() here works end
i thankful hints on how executed fast possible.
try adding call drawnow
in loop, have pause. should poll gui changes in state.
since onestep
function quick, might want call drawnow
every 10th iteration (for example), depending on gui lag can tolerate.
Comments
Post a Comment