MATLAB throws "Operation terminated by user" by itself
51 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all!
I have recently installed MATLAB R2021b, and I am facing a problem that I have not had before (with other MATLAB versions).
I have realised that when running two instances of MATLAB with the same script, MATLAB stops with a "Operation terminated by user" message. Of note, the script is the same but slightly modified, e.g. modifying one line like this
files_path = "D:\Path\To\Files\FolderA"
to this
files_path = "D:\Path\To\Files\FolderB"
The first MATLAB instance runs with no problem, but just when running the second instance, the first one stops with the "Operation terminated by user" message. By investigating a bit more, I have realised that it seems to be related with modifying the script and saving it, not with running the script itself (remember that when a script is ran, it is automatically saved). I also think that it is probably related with having the first instance minimized or maximized in background....
Its a bit difficult to assess this problem, as it do not always happen, and repeating the same actions some times yield to an error and others do not (it throws the error about a 50% of the times).
PS: I think that is not related with the function that MATLAB runs.
Does anybody knows something about this issue?
Thank you in advance.
Víctor
2 commentaires
DGM
le 20 Nov 2021
By default, whenever MATLAB receives focus, the file that's open in the editor is checked for changes. If the copy on disk has been changed, the changed file is loaded automatically. This much can be changed in editor settings.
I have not noticed this interrupting a running script, but it wouldn't surprise me if it does that in newer versions. You may try seeing if changing the automatic reloading settings change anything.
Otherwise, I don't know. I don't have anything that new.
Réponses (1)
Kumar Pallav
le 26 Nov 2021
I understand that you are facing a problem when trying to run several instances of MATLAB processes executing the same script.
Please note that the above behaviour is a known bug in MATLAB R2021b. This has already been communicated to the developers and we are working actively on fixing the bug.
As for now there are two potential workarounds:
1. You can try to uncheck the “Reload unedited files that have been externally modified” option in Preferences>Editor/Debugger and then try again. However, this will open a dialog box asking to reload the file each time you open a script in a new MATLAB instance.
2.The second one is to open the script in an external IDE (such as VSCode) and modify the script from there. VSCode in particular allows you to have documents autosave changes, so you can easily make modifications to the same script while others are running without having to repeatedly save the script manually. The biggest drawback, however, is that you will not have access to the tools and features that MATLAB’s in-built script editor has.
0 commentaires
Voir également
Catégories
En savoir plus sur Environment and Settings 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!