fclose() - How do I close all open files but one?

33 visualizaciones (últimos 30 días)
Jean Laverenne
Jean Laverenne el 21 de Nov. de 2017
Respondida: Walter Roberson el 1 de Dic. de 2017
I'd like to close all my open files but one, is there a simple way to do it? Simpler than deleting them one by one?
It's possible for variables with:
clearvars -except variable_needed
But unsurprisingly the following does not work:
fclose all -except fileID
Thanks,

Respuestas (2)

Tony Mohan Varghese
Tony Mohan Varghese el 1 de Dic. de 2017
Currently, there is no way to close all open files, except one.

Walter Roberson
Walter Roberson el 1 de Dic. de 2017
There is no direct way. You can
arrayfun(@fclose, setdiff(fopen('all'), fileID));
provided the fileID is given as numeric.

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by