How to kill an execution in app designer
Show older comments
hello i am working on matlab app design. i need a solution some kind of system command that can kill the all the exicution on matlab when i click on app design button component.
7 Comments
Mario Malic
on 12 Sep 2020
What does it mean "kill the all the exicution on matlab"? Do you want to close the application or do you want to stop execution of function or part of the code in function?
Explain your problem in details.
Matlab does not have a function that stops any and all execution. The closest thing you can do is to press ctrl+c but even that doesn't always stop any and all execution.
One way to stop execution as soon as possible by pressing a button in an app is to use a callback function that merely sets a flag value. Your other code can periodically check the value of that flag and can stop execution when needed by issuing an error or a return.
More info:
saeed ahmed
on 13 Sep 2020
Edited: saeed ahmed
on 13 Sep 2020
Mario Malic
on 13 Sep 2020
"I need it in the form of function or in the form of a system command." We don't know details, again. Until provieded, we are not able to help that much.
saeed ahmed
on 20 Sep 2020
Edited: saeed ahmed
on 20 Sep 2020
Walter Roberson
on 20 Sep 2020
See my Answer. In particular, the third link contains a list of every possibility that I was able to think of for terminating a function without its cooperation.
Mario Malic
on 20 Sep 2020
Screenshot of an app is not a specific detail. Specific detail would be, to show us the commands executed that are relevant to what you want to do (not all the code). When you press Start Training button, show us part of the code where iteration takes one hour, or make an example if it's not possible to share it.
Walter's answer is more than helpful if you want to tackle the problem yourself.
Answers (1)
Walter Roberson
on 13 Sep 2020
2 votes
What you ask for is not always possible in a single MATLAB session. You might need a second MATLAB session to do the monitoring and send a signal or use system "taskkill" to kill the MATLAB session.
If you use a parfeval "future" then you can cancel the future to halt execution, but it is not publically defined the circumstances under which a future will shut down.
If you are executing inside the Symbolic Toolbox computation engine, then that is a separate process that MATLAB uses TCP/IP to talk to, and nothing you can do inside MATLAB can affect it (except to kill the process.)
If you are executing inside a DLL, including executing inside LAPACK or MKL automatically called on your behalf by MATLAB to perform high performance calculations, then those are not listening for interruptions and you cannot get control back until they return, except by killing your MATLAB process.
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!