Filter löschen
Filter löschen

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

34 Ansichten (letzte 30 Tage)
Jean Laverenne
Jean Laverenne am 21 Nov. 2017
Beantwortet: Walter Roberson am 1 Dez. 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,

Antworten (2)

Tony Mohan Varghese
Tony Mohan Varghese am 1 Dez. 2017
Currently, there is no way to close all open files, except one.

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

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by