I"m make the efforts to use "questdlg" to shows inquiry dialog with numerous buttons. My target is that as soon as I click "stop" switch in the dialog produced by utilizing "questdlg", no more execution of code."switch" is supplied to specify each action of buttons best after "questdlg".

You are watching: How to stop a code in matlab


I"m making use of break and also return and they"re all simply to get out of the "switch". How deserve to I abort all password running by making use of command?
*


https://www.wgc2010.org/matlabcentral/answers/265361-how-to-stop-further-execution-of-m-script-by-using-command#comment_770047


return just returns indigenous the present function. If you room servicing a callback because that a pushbutton, girlfriend are simply going to return indigenous the callback, without having affected anything in the loop of code that is executing.
The paper definition of the question is the the user has actually a calculate loop and wishes to have the ability to click a button and also have the calculate loop interrupted. When graphics interruptions are serviced the is in a call back function. The inquiry then becomes:
is over there a way for the callback role to force the calculation role to abort?if not, is over there a means for the callback duty to cooperate through the calculation function to have actually the calculation function abort?
The answer because that the first of those is "NO": the just two ways to pressure something to prevent without its cooperation are to
quit or departure MATLAB; oruse java robot or similar to emit control-C into the command heat to force the regimen to avoid running
The answer come the 2nd of those possibilities is "Yes, it can be done" -- and also the techniques for act that are what I discussed in my Answer.

error() will return to the the next "try" upwards in the call stream. If you are inside a callback, the call stream more than likely is not really deep.
If you room in nested loops and want to departure out of number of of them, then you should specify a "quitthis" variable that is tested appropriate after the finish of every loop, issuing a "break" if detected, and also in this means having the quitting cascade the end of every one of the loops.
If you have actually a loop that is executing and also you desire to have the ability to interrupt it with a GUI action, climate you require to have the GUI collection a change in a ar that the loop polls the value of regular to identify whether it is being told come quit. The termination need to be cooperative: there is no means for a GUI aspect to force a loop to quit. For example,
Notice I offered a toggle, not a pushbutton. Pushbuttons have their worth reset come 0 ideal after their callback is taken.
*

https://www.wgc2010.org/matlabcentral/answers/265361-how-to-stop-further-execution-of-m-script-by-using-command#comment_1009837


As currently mentioned through Walter Roberson there no recognize solution yet. In fact, I wrote a role "dbexit", which ultimately works through
I think wgc2010.org should carry out this possibility to terminate a program cleanly or add an option in the error function, i m sorry prints just one heat without words "error" - and also without the whole role hierarchy.

Community sweetheart Hunt

Find the prizes in MATLAB main and uncover how the neighborhood can assist you!

start Hunting!

An Error Occurred

Unable to finish the activity because of transforms made to the page. Reload the page to check out its updated state.


×
*

choose a net Site

Choose a web site to obtain translated contents where easily accessible and see local events and also offers. Based upon your location, we recommend that you select: .

pick web site

How come Get best Site Performance

Select the China website (in Chinese or English) for ideal site performance. Various other wgc2010.org country sites are not optimized because that visits from your location.

See more: Should Preschool Pencils ? The 10 Best Pencils For Kindergarteners


wgc2010.org

Accelerating the pace of engineering and science

wgc2010.org is the top developer the mathematical computing software for engineers and scientists.