0

I am creating a .dat file with headers and data in Matlab, however when I try opening it from the folder where it is saved then I get the error that says 'file in use by another application and cannot be accessed'. This error occurs even when Matlab is closed. I can only open it as a text by right clicking on the file through the Matlab's current directory window. Why is this happening and how to resolve it?

1

2 Answers 2

1

You could try:

fclose('all')

to close all open files.

Sign up to request clarification or add additional context in comments.

Comments

1

This is not supposed to happen, and, in fact, doesn't happen when I try your code on my machine (OS X, R2010a). In other words, I strongly doubt that there is any problem with the Matlab code.

Try restarting Windows, then the problem should go away for newly created, differently named files.

2 Comments

I restarted the windows and tried again then it was working. Ran the code again (2 of them) and checked .dat files associated with them and still they were opening. However now suddenly again the files are showing similar error after running the code.
@Harpreet: In case its not MATLAB, you could use the tool I mentioned above (Unlocker), as it will tell you exactly which process has a locking handle on the .dat file, and allow you to release it. I use it all the time, its much easier than having to restart every time :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.