How to use the same button to begin and end a callback
Afficher commentaires plus anciens
Hello,
I have the following code:
Traj_Button = uicontrol('Style','pushbutton', 'String','Start', 'Units', 'normalized', 'Position',[0.8,0.7,0.15,0.05], 'Callback',{@Traj_Button_Callback});
function Traj_Button_Callback(source,eventdata)
if strcmp(source.String, 'Start')
source.String = 'Start';
while % Button not pushed
% code
end
else
source.String = 'End';
end
I would like to use the same pushbutton to start my callback function, and wait to en end it that user pushes the button again.
2 commentaires
Stephen23
le 15 Nov 2017
Have a look at the 'Demo' button of my FEX submission CubeHelix, it uses a toggle button to control a loop. You could do something similar with a push button.
Sébastien Marlio-Marette
le 15 Nov 2017
Réponses (0)
Catégories
En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!