Telling Igor to skip an empty data file
sjr51
I am reading into Igor a directory of delimited text files. They are the result of a web scrape and may be empty, i.e. a 0 KB file. My code gets a list of all of these files and then (in a for-loop) loads the data in each using LoadWave. I get a "no data was found in file" error if there's an empty file in the directory. I searched the help and couldn't figure out how to get Igor to skip empty files. Any tips appreciated!
You can use GetRTError to clear the error from LoadWave.
A cleaner approach is to use GetFileFolderInfo to test the number of bytes in the file.
May 5, 2019 at 08:44 pm - Permalink
Thanks Howard. For anyone reading this with the same issue:
I added a line to my for-loop to do GetFileFolderInfo (this creates a variable called V_logEOF, which has the number of bytes). I then used an if statement to test whether V_logEOF > 0 before loading the file.
May 6, 2019 at 12:03 pm - Permalink