fclose() - How do I close all open files but one?
33 ビュー (過去 30 日間)
古いコメントを表示
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,
0 件のコメント
回答 (2 件)
Tony Mohan Varghese
2017 年 12 月 1 日
Currently, there is no way to close all open files, except one.
0 件のコメント
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Workspace Variables and MAT-Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!