MATLAB throws "Operation terminated by user" by itself

조회 수: 112 (최근 30일)
Victor R
Victor R 2021년 11월 19일
답변: Kumar Pallav 2021년 11월 26일
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
DGM
DGM 2021년 11월 20일
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.
Victor R
Victor R 2021년 11월 20일
Thank you very much!
Now my PC is fully busy, buy on monday I will try it.
Also, I have compared the editor settings with the ones of my old R2019a (that do not have this problem), and the checked options are the same, so it is probably a bug (or a weird change in this functionality).

댓글을 달려면 로그인하십시오.

답변 (1개)

Kumar Pallav
Kumar Pallav 2021년 11월 26일
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.

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by