MATLAB Answers


matlab file on disk might be empty

Asked by Peter Bäuerle on 17 Jun 2019
Latest activity Commented on by Yony
on 18 Sep 2019 at 8:51
Well, I frequently get this error now, which makes it nearly impossible to improve my codes, because I always have to save the file under a new name. Is anyone familiar with this problem (current Windows 10, current Matlab R 2018.b)? I'm grateful for any hints that might solve this issue....
Thanks a lot!


Complete error message:
Error writing [filename].m
The file on disk might be empty or incomplete. Ensure there is sufficient free space on your drive, and then save the file again. Do not reload the file before you successfully save it.
Thanks for your hints so far: it is indeed related with the network. As soon as I save the file on my local disk and work on this it behave normal. Hoiwever, this an institute network and normally we are working on the network drive, were is sufficient space for large amount of data. By doing so, the error occurs permanent....
Any idea for a network solution (right now I'm working with the local drive)?
on 17 Jun 2019
Which file system do you have on the network disk? Do other computers access your files?
It might be easier to store the files locally and synchronize them, when you shut down Matlab or the computer.

Sign in to comment.

1 Answer

Answer by Guillaume
on 17 Jun 2019

I would suggest you contact your IT. There's clearly a synchronisation problem between your computer and the network drive. Note that it is not restricted to matlab, it's just that matlab is more sensitive to it.


Same issue for me on Windows 10, Folder shared over network, R2019a. Invoking the file with local file path is fine but when opened as \\computer-name\folder-name unable to save directly without first getting "Error writing ... The file on disk might be empty ..." --> OK --> "This file has been modified outside of MATLAB editor. Do you want to reload it" --> OK ... so MATLAB does save it in the end but not before throwing these error messages... Is a more specific diagnosis found yet? Thanks.
on 11 Sep 2019
@Yony, Peter Bäuerle, Qian Cao: It would be really helpful if you post more details. What e.g. is a "standard network drive"? It can be a folder on a NAS driven by a Samba server under Linux, or an old network resource connected by the outdated SMB v1. Which settings do you use for the Change Notifications? See
on 18 Sep 2019 at 8:51
Network drive NTFS from win 2012 R2.
Firewall PaloAlto FW
Laptop has Windows 10 Pro version 1709
Matlab 2017b
system_dependent('RemotePathPolicy', 'Status'): None
system_dependent('DirChangeHandleWarn', 'Status'): Once
Note that one other computer sometimes has this problem, but other don't

Sign in to comment.