fclose
Close an opened file.
📝Syntax
fclose(fid)
fclose('all')
status = fclose(fid)
status = fclose('all')
📥Input Arguments
Parameter Description
fid a file descriptor
📤Output Arguments
Parameter Description
status an integer value: 0 if file is closed or -1 if not.
📄Description

fclose must be used to close a file opened by fopen.

fclose('all') closes all opened file with fopen.

💡Examples
fd = fopen([tempdir(), filesep(), 'fclose_tst'],'wt');
status = fclose(fd)
status = fclose(fd)
🔗See Also
fopenfreadfeof
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub