file handle release
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I have a problem on the file generated by the matlab. What I do is to open data files one by one and save the meaningful data to this result file. After reading each data file, I closed the data file. At the end of the program, I fclose this result file. And I'm 100% sure the file handle is released in MATLAB. But I found I couldn't remove this result file in windows(when the criteria was set wrong ). It always says "Cannot delet xxx.txt: It is being used by another person or program. Close any programs that might be using the file and try again". I have to close the MATLAB to remove this file. Is there any other way to remove it ? Thank. BTW, I use Windows XP professional.
0 comentarios
Respuestas (4)
Kaustubha Govind
el 19 de Abr. de 2011
You could try:
fIDs = fopen('all');
for i = numel(fIDs)
fName = fopen(fIDs(i));
disp(fName);
end
To see if the file handle is somehow still open, and close the ones corresponding to your file.
0 comentarios
Jason Ross
el 19 de Abr. de 2011
Do you have any command windows or other processes open (text editor, etc) to the directory? I've lost count of the number of times I've minimized a command window that is set to a certain directory, then tried to delete that directory and windows generated a similar error.
You can also use the PS Tools to see what processes have file handles open. You can do it through Process Explorer or use the Handle command line version.
0 comentarios
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!