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

33 ビュー (過去 30 日間)
Jean Laverenne
Jean Laverenne 2017 年 11 月 21 日
回答済み: Walter Roberson 2017 年 12 月 1 日
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,

回答 (2 件)

Tony Mohan Varghese
Tony Mohan Varghese 2017 年 12 月 1 日
Currently, there is no way to close all open files, except one.

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

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by