function value = file_exist ( file_name ) %% FILE_EXIST reports whether a file exists. % % Modified: % % 29 October 2004 % % Author: % % John Burkardt % % Parameters: % % Input, character FILE_NAME, the name of the file. % % Output, logical FILE_EXIST, is TRUE if the file exists. % fid = fopen ( file_name ); if ( fid == -1 ) value = 0; else fclose ( fid ); value = 1; end