I modified a batch file loader from the forums to load tab delimitated text files. Each file is approx 3MB. I first tired using it to load a full data set(500 files) and igor froze, so then I tried to load a smaller set, 10 files, and it still crashes. Here is the code below, if someone has an idea, or a way to get it to stop freezing that would be awesome!
Function LoadAllFilesFromFolder(pathName)String pathName // Name of an Igor symbolic path or "" to get a dialogif(strlen(pathName) == 0)NewPath/O/M="Choose a folder containing TIFFs" LoadIndexedFilePath
if(V_flag != 0)return -1// User cancelledendif
pathName = "LoadIndexedFilePath"endifString fileName
Variable index
index = 0do
fileName = IndexedFile($pathName, index, "TEXT")if(strlen(fileName) == 0)break// No more files.endifLoadWave/J/M /P=$pathName fileName
index += 1while(1)End<pre><code class="language-igor">
Please send a zip archive containing whatever we need to reproduce the problem to WaveMetrics support. Include any instructions and let us know what operating system and Igor version you are using.
One data file should be sufficient - we can duplicate it 10 times here. But verify that the crash occurs if you duplicate that data file 10 times and run your procedure before sending it as we need to reproduce the problem in order to fix it.
I tried what you did and it worked fine. It seems that igor doesn't like the coding for extensionless files. Is there a work around, or do I have to add extensions to hundreds of files? which would suck
I don't get a hang or crash running the procedure on a folder containing files with no extension. Nothing loads however because no extension does not match the last parameter passed to IndexedFile.
Perhaps your problem is caused by other files in the folder other than the data files. Try removing all other files.
Here is code that will load all files with no extension and will skip files with an extension. Make sure that all files in the folder with no extension are in fact data files.
Function LoadAllFilesFromFolder(pathName)String pathName // Name of an Igor symbolic path or "" to get a dialogif(strlen(pathName) == 0)NewPath/O/M="Choose a folder containing data files" LoadIndexedFilePath
if(V_flag != 0)return -1// User cancelledendif
pathName = "LoadIndexedFilePath"endifString fileName
Variable index
index = 0do
fileName = IndexedFile($pathName, index, "????")// All filesif(strlen(fileName) == 0)break// No more files.endifString extension = ParseFilePath(4, fileName, ":", 0, 0)if(strlen(extension) == 0)// Load only if file has no extensionPrint index, fileName
LoadWave/J/M /P=$pathName fileName
endif
index += 1while(1)End
One data file should be sufficient - we can duplicate it 10 times here. But verify that the crash occurs if you duplicate that data file 10 times and run your procedure before sending it as we need to reproduce the problem in order to fix it.
October 1, 2011 at 06:44 am - Permalink
October 1, 2011 at 12:26 pm - Permalink
so no files were loaded.
I changed the file name from "0" to "Data0.txt" and duplicated the file 9 times creating "Data1.txt", "Data2.txt" and so on.
I also changed "TEXT" in the procedure to ".txt" to make sure it found the .txt files.
I also added this to the loop so I could see what is going on:
Print index, fileNameI then executed LoadAllFilesFromFolder(""), chose the folder containing the files, and all of the files were loaded.
I got no hang or crash.
In order to further investigate I need step-by-step instructions for creating the problem.
I'm running Igor Pro 6.22A on Mac OS X 10.6.3.
October 1, 2011 at 03:02 pm - Permalink
October 2, 2011 at 03:12 pm - Permalink
Perhaps your problem is caused by other files in the folder other than the data files. Try removing all other files.
Here is code that will load all files with no extension and will skip files with an extension. Make sure that all files in the folder with no extension are in fact data files.
October 2, 2011 at 07:01 pm - Permalink
October 2, 2011 at 09:41 pm - Permalink