MATLAB: Hi…how to remove automatic file that have contain not enough size normal of FITS data

fitsMATLAB C/C++ Math Librarynot enough size data

After i run the program, then suddenly appear as following on the command window
Warning: Seek failed, 'Offset is bad – after end-of-file or last character written.'. File may be an invalid FITS file or corrupt. Output structure may not contain complete file information. > In fitsinfo>skipHduData at 718 > In fitsinfo at 227 > In fitsread at 100 > In limitation at 3 > In try1 at 16
I do the limit for size of data but maybe it not appear.

Best Answer

You can use dir() to get the file size. For example if all your files are a megabyte or more you can do something like
fileInfo = dir(filename);
if fileInfo.bytes < 10000
% File is bad because it's too small.
else
% File is good.
end