도움말 센터도움말 센터
열려 있는 파일 하나 또는 모두 닫기
fclose(fileID)
fclose('all')
status = fclose(___)
예제
fclose(fileID)는 열린 파일을 닫습니다.
fileID
fclose('all')은 열려 있는 파일을 모두 닫습니다.
status = fclose(___)는 닫기 작업이 성공한 경우 0의 status를 반환합니다. 그렇지 않으면 -1을 반환합니다. 이 구문은 위에 열거된 구문 중 하나의 입력 인수에 사용할 수 있습니다.
0
status
-1
모두 축소
badpoem.txt 파일을 열고 첫 번째 라인을 읽은 후 파일을 닫습니다.
badpoem.txt
fopen을 사용하여 파일을 엽니다. 이 함수는 파일 읽기/쓰기에 사용할 고유한 파일 ID를 할당합니다.
fopen
fid = fopen('badpoem.txt')
fid = 3
fgetl을 사용하여 파일의 첫 번째 라인을 읽습니다.
fgetl
fgetl(fid)
ans = 'Oranges and lemons,'
파일을 닫습니다.
fclose(fid);
열려 있는 파일의 파일 ID로, 정수로 지정됩니다. fclose로 파일을 닫으려면 fopen을 사용하여 파일을 연 다음 파일의 fileID를 가져와야 합니다.
fclose
데이터형: double
double
backgroundPool
ThreadPool
사용법 관련 참고 및 제한 사항:
fclose('all') 구문은 스레드 기반 환경에서 지원되지 않습니다.
모두 확장
이 함수는 스레드 기반 환경을 지원합니다.
ferror | fopen | frewind | fseek | ftell | feof | fscanf | fprintf | fread | fwrite
ferror
frewind
fseek
ftell
feof
fscanf
fprintf
fread
fwrite
이 예제의 수정된 버전이 있습니다. 사용자가 편집한 내용을 반영하여 이 예제를 여시겠습니까?
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office