quit doesn't close the program - process still running in task manager

127 visualizaciones (últimos 30 días)
When I run the quit command in the command window or in a script, the application appears to close, but opening the Task Manager I find that there is still a process there taking up a large proportion of the CPU and memory named MATLAB.exe
It seems that it's still running in the background?
  4 comentarios
James
James el 28 de Sept. de 2011
Thanks Jan.
I've ran a script with just the first 4, and that went fine. Running a script with the last 3 does fine too.
But when the first script calls the second at the start, it seems to fail to quit properly.
James
James el 28 de Sept. de 2011
It seems to be when a .m file being run calls others to run with run filename

Iniciar sesión para comentar.

Respuesta aceptada

James
James el 29 de Sept. de 2011
Splitting my script into two, with the first one handling a lot of code generation and ending with a quit, always worked fine. The second script ran tests, and ended with a quit, which has always worked fine.
Any integration of these scripts, either into a single script, or into a parent and child script (i.e. one invokes the other) caused problems with Matlab not closing properly.
It's very curious, but there must be some kind of interference between some commands that doesn't allow Matlab to close properly.
This isn't really a solution, but I'd posted the question in the hope someone knew how to force a close in some way, or perhaps had experience of the problem.
  2 comentarios
Daniel Shub
Daniel Shub el 29 de Sept. de 2011
If they are scripts and not functions, you should be able to take the first line of the second script and add it to the end of the first script. Run that new script and see if you can quit. If you can, restart MATLAB and add the next line to the first script. At some point it will crash (i.e., not let you quit). Then you need to start pairing down the lines at the beginning. Once you have a MWE that repeatably reproduces the problem, you will probably see the solution. If not post the MWE here.
James
James el 29 de Sept. de 2011
I've had a go at something like that, but it's very inconsistent. The same script can be run multiple times and it won't always fail to close properly (sometimes it consistently works when run from within matlab, but consistently fails to close if it's run from the command line).
A bit hard to reduce to the problem code when it's tempermental.
Thanks though :)

Iniciar sesión para comentar.

Más respuestas (3)

Daniel Shub
Daniel Shub el 28 de Sept. de 2011
I am not sure what happens with MATLAB and rmdir if it fails to remove the directory (for example because of file permissions) it may cause MATLAB to hang. Really though you haven't given us enough to know what it happening. It is just going to be a painful line-by-line quit in between debug.
  1 comentario
James
James el 29 de Sept. de 2011
rmdir is being used to remove a directory autogenerated by another command. Thanks for the suggestion, but it's always successful.

Iniciar sesión para comentar.


Peter Barsznica
Peter Barsznica el 19 de En. de 2016
  1 comentario
James
James el 20 de En. de 2016
That is unrelated. This question is to do with a Matlab script that exits Matlab when it's done, yet Matlab continues to run.
Taskkill might work, although it seems like a bit of a brutal way to exit an application. It would take a bit more work if multiple instances of Matlab are running to ensure the correct one is killed.

Iniciar sesión para comentar.


swathi anil
swathi anil el 24 de Mzo. de 2020
Hi James,
I was facing a similar problem, not being able to exit my matlab gui figures or even the matlab window at all.
Using
quit force
worked in this case. I would recommend going through the quit command variants in the following link, to pick the one that suits your scenario:
https://de.mathworks.com/help/matlab/ref/quit.html#d120e1010208

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by