reading datetime unformatted wave

Hi All,

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
Test_min1.txt
The fundamental problem is that, in the file, all of the data is double-quoted, and Igor's LoadWave operation does not handle that.

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:


  • Replaced "DoubleQuotedTextDataFile" with "VijaypkDataFile"

  • Added the /R flag to LoadWave to specify the date format

  • Set kDefaultNameLine to 1 and kDefaultFirstDataLine to 4 to match your sample file

  • Added /W flag to LoadWave command - tells it to read wave names from the file



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:
DisplayHelpTopic "Special Folders"

Dear Rodstein,

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.

// GENERAL LOADER
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
       
IF
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
Hi again,

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