confirm valid file identifier before flcose?
이전 댓글 표시
I am using GUI callbacks to close a file. Sometimes the file is aready closed, and I get an invalid file identifier error. Is there a robust way to check if the file is still open before calling fclose? I have tried using fopen('all') but that does not always catch it.
채택된 답변
추가 답변 (2개)
Voss
2024년 2월 1일
try
fclose(fid);
catch
% file already closed, do nothing
end
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!