Recently I began having a problem with Matlab where I'm unable to open and edit or run a script without getting an error message from Matlab editor saying,
"Error writing [File I'm trying to run/save] [Location of file on disk] (The process cannot access the file because it is being used by another process)".
This only happens after I've opened any saved file and edited it. After editing I cannot run or save the file without getting this error message. I can however start a new file and am able to both save it and run it multiple times without any problems. As soon as I close and reopen it again, I get the error message.
Is there something I accidentally changed? I have checked all the permissions in Windows and I should have no problem reading or writing files.
Matlab R2013a, Windows 7 Enterprise
What is the folder of the file? Is it under c:\Program Files? If so, you're out of luck. If not, what is the folder? There are other folders that you're supposed to be able to write into but sometimes can't (like c:\ProgramData) and others that you think you should be able to but can't (like c:\users).
Close MATLAB and type Ctrl-Shift-Esc. Click the process tab. Do you still see an instance of MATLAB running?
If you don't see it, then you need to download "unlocker" http://download.cnet.com/Unlocker/3000-2248_4-10493998.html. Install that and when you get a file collision it will tell you what's got the file locked and give you the opportunity to pry it's grip off your file. Then once you see what other process has locked your file then maybe you can do something to avoid it in the future.