I am looking for a function like 'Ctrl-C'
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Halil Akcam
le 15 Juil 2017
Réponse apportée : Walter Roberson
le 16 Juil 2017
Hallo,
I have following problem:
I am working on the Appdesigner and I want to add a 'CancelButton'.
I have two buttons. The first button start a loop (function 'ButtonCallback') and the other button should terminate the execution of the function 'ButtonCallback'. I have already tried:
- exit()
- quite()
- return
- break
I am looking for a function like 'Ctrl-C'.
set(handle.Button,'Interruptible','on');
function ButtonCallback(app)
for i = 1:N
%statement
pause(0.00001);
end
end
function CancelButtonCallback(app)
%Code to terminate the 'Button1Callback(app)' function
end
thx
0 commentaires
Réponse acceptée
Walter Roberson
le 16 Juil 2017
You could try using a Java Robot to send a Key Press and Key Release event. However, this is not recommended.
You should be creating your loop to sometimes check a flag indicating whether it is being asked to stop. The cancel button should set the flag.
I do not know enough about app designer to talk about how to create shared values for it.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Downloads dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!