automated data loading
debarry
Tue, 03/27/2012 - 12:07 pm
LoadWave /D/G/W
which brings up the dialog box with all the column names in their proper place. But now how to I add the file name (minus .txt) and save?
Thanks!
Assuming that you don't want to use data folders and want to stick with your original idea . . .
This post shows how to get the file name before you call LoadWave and how to name a loaded wave using the file name.
If you know the names of the columns in the file in advance, you can extend this by extending the columnInfo variable:
String item
sprintf item, "N='Column0_%s';", wName
columnInfo += item
sprintf item, "N='Column1_%s';", wName
columnInfo += item
If you don't know the column names in advance it gets more complicated. You have to write code to determine the column names from the file.
See the documentation for the LoadWave /B flag which allows you to programmatically specify wave names.
March 27, 2012 at 01:11 pm - Permalink
wave wave0 = $(stringfromlist(0, s_wavenames)) //first wave loaded from the file
duplicate/o wave0 , $(removeending(s_filename, ".txt"))
killwaves wave0
The above "should" rename the first wave loaded as the name of the file, assuming I didn't make mistakes. You can modify it from here to deal with the other 6 waves.
March 27, 2012 at 01:18 pm - Permalink
The LoadWave /B approach permits overwriting existing waves which may or may not be desirable.
March 27, 2012 at 03:19 pm - Permalink
Now that I have an automated loader for one file, I need to make a loop to load all files in a specified folder. If anyone has a link to a topic at their fingertips that already explains this, I would much appreciate it.
March 29, 2012 at 11:36 am - Permalink
Execute:
and read through the section entitled "Loading All of the Files in a Folder".
March 29, 2012 at 08:30 pm - Permalink
This might be of some help:
http://www.igorexchange.com/node/1720
April 3, 2012 at 08:06 am - Permalink