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!