Stop a function before close request function finishes
Ältere Kommentare anzeigen
Hi,
I am currently creating an app using App Designer and I'd like it to be fool proof as much as possible. My goal is the compute data from a serial port to a graph that will uptade in real time as long as one state button is pressed. This works perfectly, however when the program is closed while the state button is pressed, I get an error that says "Invalid or deleted obejct". I suppose that this is due to the fact that I am currently in the middle of a function (the one that appends the the graph) and I just close the program before letting the function finish.
I tried to force the state of the button to 0 when I close the program, but that doesn't change anything as I close the app before the function even finishes. I know that what I need to do is to force the state of the button to 0, return from the closing function, let the plot function finish one last time, then close the program again. I guess I could also have a pop up box that says to change the state of the button manually. However these methods do not seem really elegant to me and I'd like to have a way to automatize the whole process in a single confirmation.
Also, this error is only annoying as it does not affect the program in any way and only pops up in matlab once the program has finished. But still, I'd like to have a job well done, error-free.
Thanks in advance,
Nathaniel
2 Kommentare
Alex Mcaulley
am 8 Mär. 2019
Using the try/catch formula in your function could be a solution to avoid errors.
Nathaniel Brochu
am 11 Mär. 2019
Antworten (0)
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!