![](/profiles/wavemetrics/themes/wavemetrics/logo.png)
Loadwave question
![](/sites/default/files/styles/thumbnail/public/default_images/Artboard%201_1.png?itok=jeHOCIXy)
LaMP
I am trying to load a file (.dat) that has 11 columns. The first column is time (00:00:00), the following columns are numbers (with decimals) separated by tabs.
Igor loads the 11 columns, but it is not separating the data in the columns. I end up with a matrix of 11 columns all containing the same values, which appears to be that of the first column. I have tried altering the "loadwave/v=", but nothing seems to work for now.
I would be grateful for all suggestions.
Thanks
Here is the code that I am using.
Function LoadLog() // Loads Log data // Prompts to select folder into which data is loaded String PathToFldr="",CtrlName="",PromptStr="Select folder to load Log data into:",CurrentFldr=getdatafolder(1) // variables for Browse4Folder Browse4Folder(PathToFldr,CtrlName,PromptStr,CurrentFldr) // prompts user to select an experiment // Get folder with data in it NewPath/M="Select folder containing Log data:"/O/Q pathname // prompts user to select path to data folder PathInfo pathname // Abort if cancel is pressed If(V_flag==0) Abort "proceedure cancelled" EndIf // Make matrix for Log data Make/o/n=(0,11) LogDataMatrix // Strings and Variables Variable numfolders,n, subdirs, numfiles, filenum, refnum // variables String folderlist, filename, name, currentfolder // strings // Counts number of files in folder NumFiles=ItemsInList(IndexedFile(pathname,-1,".dat")) // # files in folder , specify extensions e.g. ".txt" For(filenum=0;filenum<numfiles;filenum+=1) // loops through each file name filename=s_path+StringFromList(filenum,IndexedFile(pathname,-1,".dat")) // get full path to data file , specify extensions e.g. ".txt" If(Stringmatch(FileName,"*Log*")==1) Open /R/P=pathname/Z refNum as filename // open FStatus refNum // check there is data in file If(V_logEOF>10) // specify minimum file size to load e.g. >10bytes Load_Log_File(filename, refnum) // calls function to load file // unique function for specific file format Wave Temp_LogDataMatrix0 // add loaded waves to loaded data InsertPoints DimSize(LogDataMatrix,0),DimSize(Temp_LogDataMatrix0,0), LogDataMatrix LogDataMatrix[DimSize(LogDataMatrix,0)-DimSize(Temp_LogDataMatrix0,0),*][]=Temp_LogDataMatrix0[p-DimSize(LogDataMatrix,0)+DimSize(Temp_LogDataMatrix0,0)][q] currentfolder=GetDataFolder(1) // root folder for experiment Endif // end data to folder allocation EndIf EndFor // end loop through files of a dp Close/A // close open files Killwaves Temp_LogDataMatrix0 // Do additional analytsis on Log data //ProcessLog() // adds a time wave End Function Load_Log_File(filename, refnum) // load single Log file String filename Variable refnum print "Loading: " + filename loadwave/v={"/t","",1,1}/q/a/n=Temp_LogDataMatrix/m/o/j/k=1/l={0,0,0,0,0} filename // loads Log data as a matrix End
If that is not the solution then please zip the file or a representative part of it that illustrates the problem and attach the zip file to a post.
November 11, 2013 at 08:46 am - Permalink