Skip to Main Content Skip to Search
Product Documentation

fclose - Close one or all open files

Syntax

fclose(fileID)
fclose('all')
status = fclose(...)

Description

fclose(fileID) closes an open file. fileID is an integer file identifier obtained from fopen.

fclose('all') closes all open files.

status = fclose(...) returns a status of 0 when the close operation is successful. Otherwise, it returns -1.

See Also

feof | ferror | fopen | fprintf | fread | frewind | fscanf | fseek | ftell | fwrite

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS