
Load n files from a directory

MatLey
I would like to load a serie of binary images and assign the name of the file each. Reading the forum I found a function and I modified it:
Function load()
NewPath myPath
String name,list=IndexedFile(myPath, -1, ".dat")
Variable i,numFiles=ItemsInList(list,";")
for(i=0;i<numFiles;i+=1)
name=StringFromList(i,list)
GBLoadWave/O/T={16,16}/S=393/W=1/P=myPath name
//ImageLoad/T=TIFF/P=myPath name
endfor
End
I use the comand GBLoadWave but I don't know how I can use a variable (i) or a string (name) like a wave name.
Thanks,
MatLey
S_waveNames -- semicolon separated list of names of loaded waves
S_fileName -- name of file loaded (such as "file1.dat")
You can use these to get a reference to the loaded wave and rename it to the same name as the file. See modifications to your function.
The "$" operator seems to be what you were looking for. Type: DisplayHelpTopic "Converting a String into a Reference Using $" into the command line to see more about it.
June 19, 2012 at 06:31 am - Permalink
June 19, 2012 at 08:54 am - Permalink