"The file has been modified outside of MATLAB Editor. Do you want to reload it?" error. How to repair that?

50 Ansichten (letzte 30 Tage)
I receive error message: "The file has been modified outside of MATLAB Editor. Do you want to reload it?" almost every time when I click somewhere outside Matlab. I receive that error message about 30 times a day. It is really annoying. In fact all my document are saved on network drive but I am only person who works on that documents. It happens for every documents of Matlab. Could you please help me resolve that issue?
  1 Kommentar
SteveM
SteveM am 19 Okt. 2022
I had exactly the same problem.
What solved it for me was to move the MATLAB code files (in my case an application in the App designer) onto a local drive. I was using Dropbox as storage before, and assume that something in the background SYNC process was upsetting Matlab. Now it works fine.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Guillaume
Guillaume am 22 Mär. 2017
There is probably an issue with your network drive where the modification timestamp on the file keeps changing, hence why matlab would think the file have changed.
If you can't fix the issue with the network drive (or use a local drive instead), then you can turn the warning off (it's not an error) by going into Preferences -> Editor/Debugger and untick Reload unedited files that have been externally modified.
  6 Kommentare
Josh Licata
Josh Licata am 11 Nov. 2022
@Marek Jarocinski old thread but I can confirm the the exact same issue with git and it is driving me crazy. I haven't found a solution yet
Marek Jarocinski
Marek Jarocinski am 14 Nov. 2022
Bearbeitet: Marek Jarocinski am 14 Nov. 2022
@Josh Licata What solved the problem for me was to disable Matlab source control. I copy and paste from Matlab help how to do it:
------
Disable Source Control
When you disable source control, MATLAB does not destroy repository information. For example, it does not remove the .svn folder. You can put the folder back under source control by enabling the source control integration again.
  1. On the Home tab, in the Environment section, click Preferences.
  2. In the Preferences dialog box, in the MATLAB > General > Source Control pane, select None.
------

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (3)

Adam Danz
Adam Danz am 14 Aug. 2020
Bearbeitet: Adam Danz am 14 Aug. 2020
This is a band aid, not a solution.
This is the error dialog that appears when a files stored on a mapped network drive are edited and saved - even if just 1 character was changed. It might be a different error from the one described by OP but it sounds similar.
Pressing OK then leads to this dialog box,
Press Yes. Then, from the Matlab Command Window, run
rehash path
and wait for it to complete. Then you should be able to use the m-file again.... until you make another change.
Let's hope the problem is eventually solved.
  3 Kommentare
Adam Danz
Adam Danz am 14 Aug. 2020
I saw that recommendation of yours in another thread and tried it last night but I didn't see an effect.
Just to make sure I've got the logic right, I ran "clear <filename>" after receiving this error. I'll try it again, though.
DanielFromIllinois
DanielFromIllinois am 29 Jun. 2021
rehash path worked for me. I'll say that I made one more change to the file and the error appeared one last time and then it was gone.
Also for me, the error occured when running two instances of matlab and it was the second editor / window that was causing it. I had the other matlab running a process.

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 15 Nov. 2022
One of the ways this can occur is if you are using a network file system, either local or something like OneDrive, and if the system time on the network system is notably different than the system time on your own system, especially if your system time is slow relative to the time at the server.
For example suppose you write a change at 14:09:17 local time on your system, but the time at the server is 14:09:22, so 14:09:22 is the time recorded at the server, while your MATLAB saved internal information that the file was modified at 14:09:17 (local time.) Then MATLAB does a periodic check to see whether the file was updated (somehow), and it sees the timestamp of 14:09:22 recorded at the server, compares that to the 14:09:17 it knew, and says "Oh, it got updated on the server!" . So you bring down the latest version, and the first modification... same thing happens, the time on the server version of the file is notably newer than the time known to MATLAB, and there goes the message again.
Because time differences even on well-run systems are a fact of life (it is surprisingly hard to synchronize clocks -- impossible according to Relativity), the MATLAB end has a built-in "grace time": if the time difference is small enough then MATLAB assumes it is due to network time differences. But if the diffrence is large enough you can get problems.
Sometimes, on some systems, rebooting the system is enough to prod the system to get a better time. But sometimes you need to synchronize your clock using a service designed to keep clocks synchronized. In Windows 10 see https://pureinfotech.com/sync-clock-windows-10/
  1 Kommentar
Walter Roberson
Walter Roberson am 15 Nov. 2022
Another way this can happen is if you are using Windows 10 and OneDrive and you have immediate synchronization turned on, then at least for some range of Windows patches, the file synchronization can fail to operate properly, resulting in a disagreement between systems about what the contents of the file are. To get around this you had to turn off immediate synchronization. (Possibly this problem has been patched by now, I do not know.)

Melden Sie sich an, um zu kommentieren.


Marzena Prokopiuk
Marzena Prokopiuk am 22 Mär. 2017
New error message appeared. It says: The file on disk might be empty of incomplete. Ensure there is sufficient free space on your drive, and then save the file again..." - attached. I am sure I have free space on that network drive. what can I do? It is problem with network drive itself?
  1 Kommentar
Andy Brown
Andy Brown am 18 Nov. 2019
I only get this error message if I have two versions of Matlab running. I've only noticed it since I upgraded to Windows 10, but can't say for sure whether the problem existed before the upgrade.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by