Home > atmlab > files > fileclose.m

fileclose

PURPOSE ^

FILECLOSE Close file with error message if not succesful.

SYNOPSIS ^

function st = fileclose(fid)

DESCRIPTION ^

 FILECLOSE   Close file with error message if not succesful.

    This function calls *fclose* to close the given file, and gives an error
    if the file could not be opened. 

 FORMAT   See *fclose*.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

fileclose.m

SOURCE CODE ^

0001 % FILECLOSE   Close file with error message if not succesful.
0002 %
0003 %    This function calls *fclose* to close the given file, and gives an error
0004 %    if the file could not be opened.
0005 %
0006 % FORMAT   See *fclose*.
0007 
0008 % 2002-12-20   Created by Patrick Eriksson.
0009 
0010 
0011 function st = fileclose(fid)
0012                                                                            %&%
0013 %= Check input                                                             %&%
0014 %                                                                          %&%
0015 rqre_nargin( 1, nargin );                                                  %&%
0016 
0017 
0018 %= Call fclose
0019 %
0020 st = fclose( fid );
0021 
0022 
0023 %= Was close succesful?
0024 %
0025 if st < 0
0026   serr = sprintf( 'Could not close the file %s.', filename );
0027   error( serr );
0028 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005