reading datetime unformatted wave
vijaypk
I am new to IGOR and I am facing problem to load datetime from the attached file. It reads as text and when try to convert it using str2num, it gives all NAN values.
Can anyone please provide me loadwave syntax for the attached data, i will really appreciate it. thank you very much in adv.
Also I have another issue, I want to load data from multiple folders... e.g. C:/Data/date1/1.txt, C:/Data/date2/2.txt, and so on.. I want to load all files within "Data" folder.
Any help/suggestion would be much appreciated.
Thank you
I previously wrote Igor procedures to deal with double-quoted data and posted it at http://www.igorexchange.com/node/6880.
I have attached a revised version that I adapted for your file. The changes are:
To use this, extract the attached zip file into your "Igor Procedures" folder and restart Igor. Then choose Data->Load Waves->Load Vijaypk File.
But first, to learn about Igor Procedures, execute this in Igor:
June 13, 2016 at 10:02 pm - Permalink
Thank you for your quick response. However, I found other way to do it, using GENERAL LOADER routine which reads first datetime column as TextWave. Now would it possible to remove double quotes and convert TEXT into STRING or Datetime format? OR simply extract yyyy,mm,dd,hh,mm,ss from the TEXT wave?
Thank you for your suggestions.
FUNCTION GENERAL_LOADER(FileType, OffSet)
STRING FileType
VARIABLE OffSet
STRING filepath
STRING filename
NVAR UTCTimeDiff
close /A
SVAR FilePath1
VARIABLE index = 0
VARIABLE refNum
VARIABLE lineNum, len
STRING fullFilePath
//DECLARATION OF WRITTEN FILES
STRING tempFileName = "IGORTEMPFILE.UEITF"
STRING tempFileName2
STRING returnChar = "\r"
VARIABLE tempFileIndex = 0
VARIABLE refNumTempFile
NewPath /O /Q tempPath
filePath = "tempPath"
PATHINFO $filePath
fullFilePath = S_path
FilePath1 = fullFilePath
print fullFilePath
STRING buffer
DO
tempFileName2 = indexedfile($filePath, tempFileIndex, ".UEITF")
IF (strlen(tempFileName2)>0)
DeleteFile /P=$filePath tempFileName2
ELSE
BREAK
index += 1
WHILE (1)
OPEN /P=$filePath refNumTempFile as tempFileName
IF (strlen(FileType) == 0)
FileType = "????"
ENDIF
DO
filename = indexedfile($filePath, index, FileType)
IF (strlen(filename) == 0)
BREAK
ENDIF
//fullFilePath = stringConcate(S_path, filename); // LOADING CommonFunctions REQURIED
//PRINT fullFilePath;
OPEN /R /P=$filePath refNum as filename
lineNum = 0
DO
FReadLine refNum, buffer
len = strlen(buffer)
IF (len == 0)
Break
ENDIF
IF (lineNum >=OffSet)
FBinWrite refNumTempFile, buffer
IF (CmpStr(buffer[len-1],"\r") != 0) // Last line has no CR ?
FBinWrite refNumTempFile, returnChar
ENDIF
ENDIF
lineNum += 1
WHILE(1)
index += 1
CLOSE refNum
WHILE(1)
CLOSE refNumTempFile
CLOSE /A
IF (cmpstr(".dat", FileType) == 0)
LOADWAVE/J/D/K=0/A/R={English,2,2,2,2,"DayOfMonth.Month.Year",40} /P=$filePath tempFileName
ELSE
LOADWAVE /J/D/K=0 /A/R={English, 2, 2, 2, 2, "Year-Month-DayOfMonth", 40} /P=$filePath tempFileName
ENDIF
END
June 13, 2016 at 11:14 pm - Permalink
I tried doing this "To use this, extract the attached zip file into your "Igor Procedures" folder and restart Igor. Then choose Data->Load Waves->Load Vijaypk File.", but I get the error message for "V_Flag" - unknown/inappropriate name or symbol. I am using 6.10A version.
Thank you for your help,
Vijay
June 14, 2016 at 01:00 am - Permalink
That is very old. Choose Help->Updates for Igor.
June 14, 2016 at 09:31 am - Permalink
Vijay
June 15, 2016 at 06:00 am - Permalink
Vijay
June 15, 2016 at 06:00 am - Permalink