force_delete

Versione 1.0.0.0 (1,57 KB) da Alan
Forces the deletion of a file; without the warning: File not found or permission denied.
934 download
Aggiornato 25 gen 2013

Visualizza la licenza

Picture the scenario:

You have opened the same file twice, first for writing and then for reading, you now have two file identifiers for the one file. But you have 'misplaced' the one of the file identifiers that you were using. You use fclose on the remaining file identifier but then wonder why you are getting the 'File not found or permission denied' warning when you try to delete the file. Yes you could use fclose('all') but then you will close all the other files you have open as well.

Just use: force_delete(filename)

it will find all the file identifiers associated with your file, fclose them all and then delete your file.

Will not work if the file you want to delete is open in a program outside of MATLAB

Cita come

Alan (2026). force_delete (https://it.mathworks.com/matlabcentral/fileexchange/40012-force_delete), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2012a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Startup and Shutdown in Help Center e MATLAB Answers
Versione Pubblicato Note della release
1.0.0.0